Vim FAQ 10.9に関する情報が役立つ場合があります。
10.9. When I use my arrow keys, Vim changes modes, inserts weird characters
in my document but doesn't move the cursor properly. What's going on?
There are a couple of things that could be going on: either you are using
Vim over a slow connection or Vim doesn't understand the key sequence that
your keyboard is generating.
If you are working over a slow connection (such as a 2400 bps modem), you
can try to set the 'timeout' or 'ttimeout' option. These options, combined
with the 'timeoutlen' and 'ttimeoutlen' options, may fix the problem.
The preceding procedure will not work correctly if your terminal sends key
codes that Vim does not understand. In this situation, your best option is
to map your key sequence to a matching cursor movement command and save
these mappings in a file. You can then ":source" the file whenever you work
from that terminal.
For more information, read
|'timeout'|
|'ttimeout'|
|'timeoutlen'|
|'ttimeoutlen'|
|:map|
|vt100-cursor-keys|
から:h vt100-cursor-keys
:
Other terminals (e.g., vt100 and xterm) have cursor keys that send <Esc>OA,
<Esc>OB, etc. ...
したがって、おそらくnnoremap
矢印Esc
のキーシーケンスでファイルを保存し、残りの文字は単独で解釈されているため、A
挿入モードに入っています。
オプション'autowriteall'
を使用するか、別のマッピングを使用してファイルを保存することを検討できます。これらは で定義されてい$VIMRUNTIME\mswin.vim
ます。
" Use CTRL-S for saving, also in Insert mode
noremap <C-S> :update<CR>
vnoremap <C-S> <C-C>:update<CR>
inoremap <C-S> <C-O>:update<CR>
この:update
コマンドは に似て:w
いますが、ファイルが変更されている場合にのみ書き込みます。