Bash 設定 vi mode

蟹蟹你哦發表於2024-09-15

Bash 設定 vi mode

bash shell在行模式編輯內容時,模式為emacs的操作模式

檢視 readline 的 man 手冊內容如下

$ man readline

...

editing-mode (emacs)
	Controls whether readline begins with a set of key bindings similar to Emacs or vi.
	editing-mode can be set to either emacs or vi.
	
keymap (emacs)
	Set  the  current  readline  keymap.
	The set of legal keymap names is emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command, and vi-insert.
	vi is equivalent to vi-command; emacs is equivalent to emacs-standard.
	The default value is emacs.  The value of editing-mode also affects the default keymap.

編輯 $HOME/.inputrc

vim $HOME/.inputrc
## author: colinx
#

$include /etc/inputrc

set editing-mode vi
set keymap vi

相關文章