|
|
Line 1,488: |
Line 1,488: |
|
| |
|
| === Readline Conditional Constructs === | | === Readline Conditional Constructs === |
| Readline implements a facility similar in spirit to the conditional compilation features of the C
| | Readlineは、Cプリプロセッサの条件付きコンパイル機能に似た機能を実装しており、テストの結果としてキーバインディングや変数設定を実行することができる。 使用されるパーサ・ディレクティブは4つある。 |
| preprocessor which allows key bindings and variable settings to be performed as the result of
| |
| tests. There are four parser directives used.
| |
|
| |
|
| $if The $if construct allows bindings to be made based on the editing mode, the terminal being
| | ;$if |
| used, or the application using readline. The text of the test, after any comparison oper‐
| | :$if構文では、編集モード、使用中の端末、readlineを使用するアプリケーションに 基づいてバインディングを行うことができる。 比較演算子の後のテスト・テキストは行末まで続く。 |
| ator,
| |
| extends to the end of the line; unless otherwise noted, no characters are required to
| |
| isolate it.
| |
|
| |
|
| mode The mode= form of the $if directive is used to test whether readline is in emacs or
| | :;mode |
| vi mode. This may be used in conjunction with the set keymap command, for in‐
| | ::ifディレクティブのmode=は、readlineがemacsモードかviモードかをテストするために使われる。 これは、例えば、readlineがemacsモードで起動している場合にのみ、emacs-standardとemacs-ctlxのキーマップのバインディングを設定するために、set keymapコマンドと組み合わせて使用することができる。 |
| stance, to set bindings in the emacs-standard and emacs-ctlx keymaps only if read‐
| |
| line is starting out in emacs mode.
| |
|
| |
|
| term The term= form may be used to include terminal-specific key bindings, perhaps to
| | :;term |
| bind the key sequences output by the terminal's function keys. The word on the
| | ::term=形式は、端末固有のキーバインディングを含めるために使用される。おそらく、 端末のファンクションキーが出力するキーシーケンスをバインドするためであろう。 の右側の単語は、端末のフルネームと、端末名の最初の - より前の部分の両方に対してテストされる。 これにより、例えばsunはsunとsun-cmdの両方にマッチする。 |
| right side of the = is tested against both the full name of the terminal and the
| |
| portion of the terminal name before the first -. This allows sun to match both sun
| |
| and sun-cmd, for instance.
| |
|
| |
|
| version
| | :;version |
| The version test may be used to perform comparisons against specific readline ver‐
| | ::バージョン・テストは、特定のリードライン・バージョンとの比較を実行するために使用することができる。 バージョンは現在のリードラインバージョンに展開される。 比較演算子のセットには、=、(と==)、<nowiki>!=、<=、>=、<、></nowiki>がある。 演算子の右側に与えられるバージョン番号は、メジャーバージョン番号、オプションの小数点、オプションのマイナーバージョン(例えば、7.1)から構成される。マイナーバージョンが省略された場合、それは0であると仮定される。演算子は、文字列バージョンと空白によってバージョン番号の引数から分離することができる。 |
| sions. The version expands to the current readline version. The set of comparison
| |
| operators includes =, (and ==), !=, <=, >=, <, and >. The version number supplied
| |
| on the right side of the operator consists of a major version number, an optional
| |
| decimal point, and an optional minor version (e.g., 7.1). If the minor version is
| |
| omitted, it is assumed to be 0. The operator may be separated from the string ver‐
| |
| sion and from the version number argument by whitespace.
| |
| | |
| application
| |
| The application construct is used to include application-specific settings. Each
| |
| program using the readline library sets the application name, and an initialization
| |
| file can test for a particular value. This could be used to bind key sequences to
| |
| functions useful for a specific program. For instance, the following command adds
| |
| a key sequence that quotes the current or previous word in bash:
| |
|
| |
|
| | :;application |
| | ::アプリケーション構文は、アプリケーション固有の設定を含めるために使用される。 readlineライブラリを使用する各プログラムはアプリケーション名を設定し、初期化ファイルは特定の値をテストすることができる。 これを利用して、キー・シーケンスを特定のプログラムにとって有用な関数にバインドすることができる。 例えば、次のコマンドは、bashで現在または前の単語を引用するキーシーケンスを追加する: |
| | <syntaxhighlight lang="bash"> |
| $if Bash | | $if Bash |
| # Quote the current or previous word | | # Quote the current or previous word |
| "\C-xq": "\eb\"\ef\"" | | "\C-xq": "\eb\"\ef\"" |
| $endif | | $endif |
| | </syntaxhighlight> |
|
| |
|
| variable
| | :;variable |
| The variable construct provides simple equality tests for readline variables and
| | ::変数構文は、readline変数と値の簡単な等値テストを提供する。 変数名と比較演算子は空白で区切られ、演算子と右辺の値は空白で区切ることができる。 文字列変数もブーリアン変数もテストすることができる。ブール変数は、onとoffの値に対してテストされなければならない。 |
| values. The permitted comparison operators are =, ==, and !=. The variable name
| |
| must be separated from the comparison operator by whitespace; the operator may be
| |
| separated from the value on the right hand side by whitespace. Both string and
| |
| boolean variables may be tested. Boolean variables must be tested against the val‐
| |
| ues on and off.
| |
| | |
| $endif This command, as seen in the previous example, terminates an $if command.
| |
|
| |
|
| $else Commands in this branch of the $if directive are executed if the test fails.
| | ;$endif |
| | :このコマンドは、前の例で見たように、$ifコマンドを終了させる。 |
|
| |
|
| $include
| | ;$else |
| This directive takes a single filename as an argument and reads commands and bindings from
| | :$ifディレクティブのこのブランチにあるコマンドは、テストが失敗した場合に実行される。 |
| that file. For example, the following directive would read /etc/inputrc:
| |
|
| |
|
| | ;$include |
| | :このディレクティブは1つのファイル名を引数として取り、そのファイルからコマンドとバインディングを読み込む。 例えば、以下のディレクティブは/etc/inputrcを読み込む: |
| | <syntaxhighlight lang="bash"> |
| $include /etc/inputrc | | $include /etc/inputrc |
| | </syntaxhighlight> |
|
| |
|
| === Searching === | | === Searching === |