質問
は、
経由のviやemacsを使用するようにbashシェルを設定し、プログラミングの観点から、set -o vi
または
set -o emacs
実際にここで何が起こっていますか?私はそれがbashシェルは、シェル自体への入力のためにこれらのエディタのいずれかを使用して主張して本を読んできたが、私はそれがreadlineを使用している可能性が考えられます。
解決
bashはまだreadlineのを使用しています。 Readlineのは、Emacsやviモードのいずれかを使用し、様々なエディタモード間のモードスイッチを設定します。あなたは、様々なキーバインディングを確認するために、ベースのソースコード内のlib / readlineのフォルダを確認することができます。
他のヒント
のマニュアルページによればBASH_BUILTINS(1)(Fedoraの8上):
set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
...(すべての単一文字のオプションをスキップ)
-o option-name The option-name can be one of the following:
...
emacs Use an emacs-style command line editing interface. This is enabled by default when the shell is interactive, unless the shell is started with the --noediting option....
vi Use a vi-style command line editing interface.私はbashが直接行編集のためのコマンドを解釈していることを意味することを解釈します。このオプションは、単に使用するように設定されているコマンドを設定します。 readlineの(3)のmanページを参照してください。
これは、コマンドラインを編集し、それらの編集者の一人のユーザーに精通しているキーストロークを使用します。
のReadlineはバッシュ、および他のプログラムにその機能を提供する施設である。
man bash
から:
READLINE This is the library that handles reading input when using an interac‐ tive shell, unless the --noediting option is given at shell invocation. Line editing is also used when using the -e option to the read builtin. By default, the line editing commands are similar to those of emacs. A vi-style line editing interface is also available. Line editing can be enabled at any time using the -o emacs or -o vi options to the set builtin (see SHELL BUILTIN COMMANDS below). To turn off line editing after the shell is running, use the +o emacs or +o vi options to the set builtin.
私が知っていることから、readline
deはbashのための行編集機能を提供するものである。
一つ但し書き:あなたはviコマンドモードでv
を押したとき、あなたはコマンドラインを編集するための本格的なvi
エディタを取得
man bash
から:
READLINE
これは、対話型シェルを使用している場合--noediting
オプションはシェルの起動時に指定されない限り、入力を読んで扱うライブラリです。デフォルトでは、行編集コマンドは、Emacsのものと同様です。 VI-スタイル行編集インタフェースも用意されています。シェルが実行されている後に行編集機能をオフにするには、+o emacs
の組み込みに+o vi
またはset
オプションを使用します。
(あなたは非編集モードでない限り)、シェルプロンプトであなたを提示すると、あなたならすでにのreadline
を使用。あなたは(あなただけのviコマンドモードに戻って取得するためにESC
を使用できる理由である)のemacsモードまたはviの挿入モードになりますどちらか。