From 463b9b99c60534c46f96531773f6ab998fe7c703 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 15 Mar 2020 12:58:51 +0100 Subject: [PATCH] Move ctrl-left/right forward-word to shared bindings These also work in vim. Fixes #6755. --- doc_src/index.rst | 4 +++- share/functions/__fish_shared_key_bindings.fish | 4 ++++ share/functions/fish_default_key_bindings.fish | 2 -- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc_src/index.rst b/doc_src/index.rst index e670f4d93..ec1512ccd 100644 --- a/doc_src/index.rst +++ b/doc_src/index.rst @@ -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. diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index b4adcefc6..aaf2342b9 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -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 diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index de109e699..6b1935b46 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -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