From cac3b239e3cfef658ae3d99a6c11602f76479ac8 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 5 Sep 2016 01:22:07 +0200 Subject: [PATCH] Use fish_vi_cursor by default Fixes #3215. --- doc_src/index.hdr.in | 2 +- share/functions/fish_vi_key_bindings.fish | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in index dd190630f..a31e12917 100644 --- a/doc_src/index.hdr.in +++ b/doc_src/index.hdr.in @@ -1038,7 +1038,7 @@ function fish_user_key_bindings end \endfish -When in vi-mode, the `fish_mode_prompt` function will display a mode indicator to the left of the prompt. The `fish_vi_cursor` function is available to change the cursor's shape depending on the mode in supported terminals. +When in vi-mode, the `fish_mode_prompt` function will display a mode indicator to the left of the prompt. The `fish_vi_cursor` function will be used to change the cursor's shape depending on the mode in supported terminals. To disable this feature, override it with an empty function. \subsubsection vi-mode-command Command mode diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index 7297b9a7d..1e03359df 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -226,10 +226,16 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -M visual -m default \cc end-selection force-repaint bind -M visual -m default \e end-selection force-repaint - set fish_bind_mode $init_mode - # Make it easy to turn an unexecuted command into a comment in the shell history. Also, remove # the commenting chars so the command can be further edited then executed. bind -M default \# __fish_toggle_comment_commandline bind -M visual \# __fish_toggle_comment_commandline + + # Set the cursor shape + # After executing once, this will have defined functions listening for the variable. + # Therefore it needs to be before setting fish_bind_mode. + fish_vi_cursor + + set fish_bind_mode $init_mode + end