Make the history session configurable

Using the FISH_HISTFILE variable will let people customise the session
to use for the history file. The resulting history file is:

    `$XDG_DATA_HOME/fish/name_history`

Where `name` is the name of the session. The default value is `fish`
which results in the current history file.

If it's set to an empty string, the history will not be stored to a
file.

Fixes #102
This commit is contained in:
tomassedovic
2017-06-30 17:13:02 -07:00
committed by Kurtis Rader
parent 6f6a4a842c
commit aec0973196
12 changed files with 213 additions and 16 deletions

View File

@@ -614,6 +614,9 @@ static void react_to_variable_change(const wcstring &key) {
invalidate_termsize(true); // force fish to update its idea of the terminal size plus vars
} else if (key == L"FISH_READ_BYTE_LIMIT") {
env_set_read_limit();
} else if (key == L"FISH_HISTFILE") {
history_destroy();
reader_push(history_session_id().c_str());
}
}
@@ -1178,7 +1181,7 @@ env_var_t env_get_string(const wcstring &key, env_mode_flags_t mode) {
history_t *history = reader_get_history();
if (!history) {
history = &history_t::history_with_name(L"fish");
history = &history_t::history_with_name(history_session_id());
}
if (history) history->get_string_representation(&result, ARRAY_SEP_STR);
return result;