LoginSignup
3
3

More than 5 years have passed since last update.

今さらtcshのキーバインドから抜けられない人にささげるbashのヒストリ検索キーバインド

Last updated at Posted at 2015-12-01

なんか思いつきでアドベントカレンダー作ったら、すでに12月1日が残り12分なのでかっとばしていくよ!

世の中Linuxとか流行ってて標準シェルがbashだけど、「おらぁtcsh育ちでキーバインドが慣れねえだぁ」っていうひと、けっこう多いはず。そうじゃない人はカエレ! まあbashはもともとインタラクティブシェル向けじゃないからね(炎上)。

なかでもいらつくのが、

$ hogefugar
something
$ hoge[ESC-p]

とやってもデフォルトで過去のhogefugarが出てきやがらないところ!

そんなときは /etc/inputrc に以下の呪文を書こう!

$if Bash
"\en": history-search-forward
"\ep": history-search-backward
$endif

これでESC-p・ESC-nを使って入力した文字から始まるコマンドヒストリをたどれるよ!

やった! 2分前に書き終わった!

3
3
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
3
3