mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-26 19:31:15 -03:00
Allow turning off autosuggestions
This adds a variable, $fish_autosuggestion_enabled. When set to 0, it will turn off autosuggestions/highlighting. Setting it to anything else will enable it (which also means this remains enabled by default).
This commit is contained in:
@@ -235,6 +235,14 @@ static void handle_fish_history_change(const env_stack_t &vars) {
|
||||
reader_change_history(history_session_id(vars));
|
||||
}
|
||||
|
||||
static void handle_autosuggestion_change(const env_stack_t &vars) {
|
||||
bool enabled = true;
|
||||
if (auto val = vars.get(L"fish_autosuggestion_enabled")) {
|
||||
if (val->as_string() == L"0") enabled = false;
|
||||
}
|
||||
reader_set_autosuggestion_enabled(enabled);
|
||||
}
|
||||
|
||||
static void handle_function_path_change(const env_stack_t &vars) {
|
||||
UNUSED(vars);
|
||||
function_invalidate_path();
|
||||
@@ -340,6 +348,7 @@ static std::unique_ptr<const var_dispatch_table_t> create_dispatch_table() {
|
||||
var_dispatch_table->add(L"fish_function_path", handle_function_path_change);
|
||||
var_dispatch_table->add(L"fish_read_limit", handle_read_limit_change);
|
||||
var_dispatch_table->add(L"fish_history", handle_fish_history_change);
|
||||
var_dispatch_table->add(L"fish_autosuggestion_enabled", handle_autosuggestion_change);
|
||||
var_dispatch_table->add(L"TZ", handle_tz_change);
|
||||
var_dispatch_table->add(L"fish_use_posix_spawn", handle_fish_use_posix_spawn_change);
|
||||
var_dispatch_table->add(L"fish_trace", handle_fish_trace);
|
||||
|
||||
Reference in New Issue
Block a user