tcsh: i-search-back 文字不良

tcsh: i-search-back 文字不良

他の答えからわかるように、CTRL-Rがbashのように動作するように.cshrcにこれを追加しました.

bindkey "^r" i-search-back

全体的に非常にうまく動作します。私の問題は、CTRL-Rの後に左右の矢印(行編集)を実行するときにカーソル位置に「[C」または「[D」を追加してから手動で削除する必要があることです。理由をご存知ですか?どうすれば回避できますか?

ベストアンサー1

読書tcsh マニュアルページ、これはうまくいきません:

   i-search-back (not bound)
           Searches  backward  like  history-search-backward,  copies  the
           first match into the input buffer with the cursor positioned at
           the end of the pattern, and prompts with `bck: ' and the  first
           match.   Additional  characters  may  be  typed  to  extend the
           search, i-search-back may be typed to continue  searching  with
           the  same  pattern,  wrapping around the history list if neces‐
           sary, (i-search-back must be bound to a  single  character  for
           this to work) or one of the following special characters may be
           typed:

               ^W      Appends the rest of the word under  the  cursor  to
                       the search pattern.
               delete (or any character bound to backward-delete-char)
                       Undoes  the  effect of the last character typed and
                       deletes a character  from  the  search  pattern  if
                       appropriate.
               ^G      If  the  previous search was successful, aborts the
                       entire search.  If not, goes back to the last  suc‐
                       cessful search.
               escape  Ends  the  search,  leaving the current line in the
                       input buffer.
           
           Any other character not bound to self-insert-command terminates
           the  search,  leaving the current line in the input buffer, and
           is then interpreted as normal input.  In particular, a carriage
           return  causes  the  current  line  to be executed.  Emacs mode
           only.  See also i-search-fwd and history-search-backward.

マニュアルページには、tcshが処理する準備ができている唯一の特殊文字はリストされた4文字であり、他の文字は次のように解釈されると示されています。

  • 検索範囲を拡張するには、追加の文字を入力できます。そして
  • 「自己挿入コマンドにバインドされていない他の文字は検索を終了し、現在の行を入力バッファに残し、通常の入力として解釈されます。

エスケープ文字(左/右矢印の一部)は印刷できない文字であるため、tcshはそれを捨てて印刷可能文字を「一般入力」の一部として残します。

おすすめ記事