LoginSignup
0
0

More than 1 year has passed since last update.

#Ruby の pry で コマンド履歴を検索して戻る/進むショートカット ( reverse-i-search / i-search ) ( Mac )

Last updated at Posted at 2020-03-21

reverse-i-search

  • Ctrl + R で pryのコマンド履歴を検索できる
  • 検索中にもういちど Ctrl + R を押すと、検索結果をひとつずつ過去に戻れる
  • だがしかし、いちど戻ると、そこから逆に進む方法が分からない
  • 戻ってから進む方法が分からずに、たまに調べては諦め、そして5年が過ぎた

image
image

解決は .inputrc

~/.inputrc に以下を設定する

"\C-t": forward-search-history
  • pryの設定ではなく、実行するシェルの設定
  • .bash_profile とか .bashrc とか .zshrc とかと同じ扱い
  • 設定したらpryを終了、再起動する

動作確認

履歴を戻りすぎた場合に Ctrl+T で進めるようになったぞ!

image
image
image

原因

readline のデフォルトのキーバインドか何かと干渉していたのかもしれない。

image

command line - readline reverse-search-history C-r repeatedly finds next cmd, how to go back to previous? - Super User

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

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