Skip to content

Commit

Permalink
Move ctrl-left/right forward-word to shared bindings
Browse files Browse the repository at this point in the history
These also work in vim.

Fixes #6755.
  • Loading branch information
faho committed Mar 15, 2020
1 parent 266ce7c commit 463b9b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion doc_src/index.rst
Expand Up @@ -1291,7 +1291,9 @@ Some bindings are shared between emacs- and vi-mode because they aren't text edi

- :kbd:`Alt+←,Left` and :kbd:`Alt+→,Right` move the cursor one word left or right (to the next space or punctuation mark), or moves forward/backward in the directory history if the command line is empty. If the cursor is already at the end of the line, and an autosuggestion is available, :kbd:`Alt+→,Right` (or :kbd:`Alt+F`) accepts the first word in the suggestion.

- :kbd:`Shift,←,Left` and :kbd:`Shift,→,Right` move the cursor one word left or right, without stopping on punctuation.
- :kbd:`Ctrl+` and :kbd:`Ctrl+` move the cursor one word left or right. These accept one word of the autosuggestion - the part they'd move over.

- :kbd:`Shift+` and :kbd:`Shift+` move the cursor one word left or right, without stopping on punctuation. These accept one big word of the autosuggestion.

- :kbd:`` (Up) and :kbd:`` (Down) (or :kbd:`Control+P` and :kbd:`Control+N` for emacs aficionados) search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the `history <#history-search>`_ section for more information on history searching.

Expand Down
4 changes: 4 additions & 0 deletions share/functions/__fish_shared_key_bindings.fish
Expand Up @@ -22,6 +22,10 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
bind --preset $argv \eOC forward-char
bind --preset $argv \eOD backward-char

# Ctrl-left/right - these also work in vim.
bind --preset $argv \e\[1\;5C forward-word
bind --preset $argv \e\[1\;5D backward-word

bind --preset $argv -k ppage beginning-of-history
bind --preset $argv -k npage end-of-history

Expand Down
2 changes: 0 additions & 2 deletions share/functions/fish_default_key_bindings.fish
Expand Up @@ -82,8 +82,6 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind --preset $argv \e\b backward-kill-word
bind --preset $argv \eb backward-word
bind --preset $argv \ef forward-word
bind --preset $argv \e\[1\;5C forward-word
bind --preset $argv \e\[1\;5D backward-word
bind --preset $argv \e\< beginning-of-buffer
bind --preset $argv \e\> end-of-buffer

Expand Down

0 comments on commit 463b9b9

Please sign in to comment.