2017-03-22 12 views
0

私はreadlineのhistory-search-forwardhistory-search-backwardをbashで使うのが大好きです。私は私の.inpurcに次のようにありますreadline/bashでviモードを使用するとhistory-searchが破損するように見える

# Scroll through matching history with up and down keys 
"\e[A":history-search-backward 
"\e[B":history-search-forward 

と私の歴史の中で一致するコマンドをスクロールするには、上下キーを使用します。

しかし、私がviモードを有効にすると、履歴検索の動作が停止しているようです。私はviのモードは(も.inputrcに)thusly設定している:私は私の.inputrcからのviモードに関連する行を削除すると、履歴検索が正常に動作します

# Enable vi mode 
set editing-mode vi 
set keymap vi-command 

# insert/command mode indicator: 
set show-mode-in-prompt on 

# Indicator formatting in prompt: 
set vi-cmd-mode-string "\1\e[0;34m\2[\1\e[0m\2C\1\e[0;34m\2]\1\e[0m\2 " 
set vi-ins-mode-string "\1\e[0;34m\2[\1\e[0m\2I\1\e[0;34m\2]\1\e[0m\2 " 

。私はそれらを戻すとき、それは壊れます。

両方の機能を同時に有効にする方法はありますか?

私は、OSB Sierraでhomebrewを通じてインストールされたGNU Bash 4.4.12を使用しています。

+2

set editing-mode vi set keymap vi-insert "\e[A":history-search-backward "\e[B":history-search-forward 

それとも、bashrcでこれを書くことができますプログラミングの質問などがありますので、[U&L](http://unix.stackexchange.com/) –

答えて

2

vi-insertモードでの私の作品:それはないですので、私は、オフトピックとして、この質問を閉じるために投票しています

set -o vi 
bind -m vi-insert '"\e[A":history-search-backward' 
bind -m vi-insert '"\e[B":history-search-forward' 
+0

より適切でしょう。ありがとうございました! – AlexJ136

関連する問題