Add backspace bindings to vi-mode

This was erroneously omitted from the previous commit.

Now backspace in insert mode does backward-delete-char, in default mode
backward-char (i.e. no deleting, just moving). This is consistent with vim.
This commit is contained in:
Fabian Homborg
2016-08-04 20:40:21 +02:00
parent b36414152b
commit 744da2cab2
2 changed files with 9 additions and 2 deletions

View File

@@ -1058,12 +1058,16 @@ Command mode is also known as normal mode.
- @key{Control, X} copies the current buffer to the system's clipboard, @key{Control, V} inserts the clipboard contents.
- @key{Control,C} deletes the entire line.
- @key{Backspace} moves the cursor left.
\subsubsection vi-mode-insert Insert mode
- @key{Escape} or @key{Control,C} enters <a href="#vi-mode-command">command mode</a>.
- @key{Control,x} moves the cursor to the end of the line. If an autosuggestion is available, it will be accepted completely.
- @key{Backspace} removes one character to the left.
\subsubsection vi-mode-visual Visual mode
- @cursor_key{&larr;,Left} and @cursor_key{&rarr;,Right} extend the selection backward/forward by one character.

View File

@@ -97,8 +97,11 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
bind -k dc delete-char
bind -k backspace backward-delete-char
bind \x7f backward-delete-char
# Backspace deletes a char in insert mode, but not in normal/default mode.
bind -M insert -k backspace backward-delete-char
bind -M default -k backspace backward-char
bind -M insert \x7f backward-delete-char
bind -M default \x7f backward-char
bind \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-delete
bind dd kill-whole-line