bashでのviモード

情けないことに、bashでviモードにできることを知ったので、試してみた。


bashでは、デフォルトで、emacsモードになっている
Ctrl+a とするとカーソルが先頭に移動したりする。
viモードにすると、0で先頭に移動したり、xで削除することができる。(通常のvi操作)

$ set -o vi

でモードを変更することができる。
慣れてないせいか、少々使いづらい感じはする。


現在の設定の確認

$ set -o
allexport off
braceexpand on
emacs on
errexit off
errtrace off
functrace off
hashall on
histexpand on
history on
ignoreeof off
interactive-comments on
keyword off
monitor on
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
pipefail off
posix off
privileged off
verbose off
vi off
xtrace off

viモードを有効にする

$ set -o vi
$ set -o
allexport off
braceexpand on
emacs off
errexit off
errtrace off
functrace off
hashall on
histexpand on
history on
ignoreeof off
interactive-comments on
keyword off
monitor on
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
pipefail off
posix off
privileged off
verbose off
vi on
xtrace off


現在のポスト数 42 / 100