0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

shellのviモード

Posted at

概要

shellでのカーソル移動等でも使いなれたVimの操作を仕様したいですよね。Vimと完全に同じとはいきませんが、おおむね実現できます。
ここでは簡単な紹介をします。より詳細な説明は

に詳しいです。

キーバインドの変更

~/.bashrcまたは~/.inputrc、に

.bashrc
set -o vi

若しくは

.bashrc
set editing-mode vi

とする。これでTerminalでもviのキーバインドで操作できる。
しかし、このままでは現在のモードが表示されない。

モード表示のしかた

~/.bashrcまたは~/.inputrcに

.bashrc
bind 'set show-mode-in-prompt on'
bind 'set vi-cmd-mode-string "\1\e[36m\2(cmd)\1\e[0m\2 "'
bind 'set vi-ins-mode-string "\1\e[36m\2(ins)\1\e[0m\2 "'

とする。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?