3

キーを1回押すだけでvim関数を待機させるにはどうすればよいですか?

例:

  • fキーが押されたときに実行するようにマップされた関数 NextOccur を作成します
  • が押されたとき、fすぐには何も役に立たないはずです
  • 次のキー(たとえばx)が押された後、カーソルは次の発生に移動する必要がありますx

PS: はい、私はそれがデフォルトで行うことを正確に知ってfいます (ただし、行単位のみですが)。

次の 2 回のキー押下を待ちたい場合、それも可能ですか?

4

1 に答える 1

5

You can use the built-in getchar() function. It waits for a single keypress and then returns it. For an ordinary 8-bit character, you have to use nr2char(getchar()) to convert it to a String.

It seems you want to extend the f / t commands to cover multiple lines, too. Be aware that there are already plugins that do that, for example ft_improved.

于 2012-12-22T01:51:13.140 に答える