From d288c7c208aa0e1c399a34f64d2008a25ae59ae3 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 2 Apr 2024 23:53:49 +0200 Subject: Edited vi/emacs modes --- .config/inputrc | 111 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 77 insertions(+), 34 deletions(-) diff --git a/.config/inputrc b/.config/inputrc index 8d3920c..adfeec4 100644 --- a/.config/inputrc +++ b/.config/inputrc @@ -1,43 +1,86 @@ $include /etc/inputrc -set editing-mode vi -set keymap vi-insert "\f": clear-screen + +set bell-style none +set meta-flag on +set input-meta on +set convert-meta off +set output-meta on +set show-all-if-ambiguous on # set show-all-if-unmodified on + +# Color files by types +# Note that this may cause completion text blink in some terminals (e.g. xterm). +set colored-stats On +# Append char to indicate type +set visible-stats On +# Mark symlinked directories +set mark-symlinked-directories On +# Color the common prefix +set colored-completion-prefix On +# Color the common prefix in menu-complete +set menu-complete-display-prefix On + +# set editing-mode vi set show-mode-in-prompt on +set keyseq-timeout 0 # Reduce the delay between pressing escape and the cursor change set vi-cmd-mode-string "\1\e[2 q\2" set vi-ins-mode-string "\1\e[6 q\2" -# Reduce the delay between pressing escape and the cursor change -set keyseq-timeout 0 - -#set -o vi -#lset keymap vi -#$if mode=vi - # set show-mode-in-prompt on - # set vi-ins-mode-string \1\e[6 q\2 - # set vi-cmd-mode-string \1\e[2 q\2 - -# set keymap vi-command - # these are for vi-command mode -# Control-l: clear-screen -# Control-a: beginning-of-line - -# set keymap vi-insert -# # these are for vi-insert mode -# Control-l: clear-screen -# Control-a: beginning-of-line -# # exit insert mode using -# "jj" # remap escape -#$endif +$if mode=vi + set keymap vi-command + # these are for vi-command mode + "\e[A": history-search-backward + "\e[B": history-search-forward + j: history-search-forward + k: history-search-backward + set keymap vi-insert + # these are for vi-insert mode + "\e[A": history-search-backward + "\e[B": history-search-forward + "jk" # escape +$endif -set bell-style none -#$if mode=vi -# set keymap vi-command -# "gg": beginning-of-history -# "G": end-of-history -# set keymap vi-insert #notice how the "jj" movement is -# "jj": vi-movement-mode #after 'set keymap vi-insert'? - # "\C-w": backward-kill-word -# "\C-p": history-search-backward -#$endif +$if mode=emacs + + "\C-P": history-search-backward + "\C-N": history-search-forward + + # for linux console and RH/Debian xterm + "\e[1~": beginning-of-line + "\e[4~": end-of-line + "\e[5~": beginning-of-history + "\e[6~": end-of-history + "\e[7~": beginning-of-line + "\e[3~": delete-char + "\e[2~": quoted-insert + "\e[5C": forward-word + "\e[5D": backward-word + "\e\e[C": forward-word + "\e\e[D": backward-word + "\e[1;5C": forward-word + "\e[1;5D": backward-word + + # for rxvt + "\e[8~": end-of-line + + # for non RH/Debian xterm, can't hurt for RH/DEbian xterm + "\eOH": beginning-of-line + "\eOF": end-of-line + + # for freebsd console + "\e[H": beginning-of-line + "\e[F": end-of-line + +$endif + +#set editing-mode emacs +set editing-mode vi +# # switch between vi or emacs +# set keymap emacs +# "\e[": vi-editing-mode +# set keymap vi-insert +# "\e[": emacs-editing-mode +# set keymap vi-command +# "\e[": emacs-editing-mode -- cgit v1.2.3