0

私はたくさんのコードを書き、特殊文字が必要になるたびにシフトを押すのにうんざりしています。また、特殊文字を頻繁に使用し、次に数値を使用するため、それらのシフト動作を逆にします。

したがって、<4>と入力すると、「$」が表示され、<shift> + <4>と入力すると、番号ごとに「4」が表示されます。このマッピングは、挿入モードでのみ機能する必要があります。

私はもう試した:

:set langmap 123...;!@#...,!@#...;123 "works only in normal-mode

:imap 4 $
:imap $ 4 "recursive mapping error
4

2 に答える 2

4

を使用します。これは、置き換えられたテキストでマップを検索しない:inoことを除いて、同じことを行います。:imap(「inoremap」の略です)これで再帰の問題が修正されます。

詳細については、こちらをご覧ください:http: //vim.dindinx.net/orig/html/map.txt.php

または、vimオンラインヘルプの場合は:h mapと入力します(同じこと、vimのすぐ内側)。

于 2010-09-10T14:47:29.553 に答える
0

差出人:help imap

If you want to exchange the meaning of two keys you should use the :noremap
command.  For example: >
   :noremap k j
   :noremap j k
This will exchange the cursor up and down commands.

With the normal :map command, when the 'remap' option is on, mapping takes
place until the text is found not to be a part of a {lhs}.  For example, if
you use: >
   :map x y
   :map y x
Vim will replace x with y, and then y with x, etc.  When this has happened
'maxmapdepth' times (default 1000), Vim will give the error message
"recursive mapping".

同じことが当てはまりますimapinoremap代わりに使用してください)。

于 2010-09-10T14:49:08.727 に答える