Improved VIM experience: Move the cursor in insert mode, I don't want to use the arrow keys! Alt shortcut key use Tips!
As we all know, when we edit the code in insert mode,
If you want to finish this part, moving to a neighboring part, following a word, is very complicated.
' \eea ' or ' directional key *n '? Although this is not complicated, especially referring to my previous document, \e (ESC) only need to press alt-;
But is there a more convenient way? I'm going to tell you, there is, Alt accelerator remapping in insert mode!
Set the key code as follows
, set the key code to determine the time, this time and the combination of key judgment time is different yo! Only need to set once: Set Ttimeout ttimeoutlen=50; set keys <M-e> key combination to \ee;\e for ESC:exec" set <m-e>=\ee"; remap <M-e> for <esc><M-e> <esc> Ea
This allows you to use ALT-E in insert mode to complete the operation after moving the cursor to the next word! It's Convenient!
Insert the following paragraph into the ~/.VIMRC, you can use the alt-w\w\e\e\h\j\k\l these shortcut keys
Inoremap <M-j> <esc>jaexec "Set <m-j>=\ej"Inoremap<M-k> <esc>kaexec "Set <m-k>=\ek"Inoremap<M-h> <esc>haexec "Set <m-h>=\eh"Inoremap<M-l> <esc>Laexec "Set <m-l>=\el"Inoremap<M-W> <esc>Wiexec "Set <m-w>=\ew"Inoremap<M-w> <esc>WIexec "Set <m-w>=\ew"Inoremap<M-E> <esc>Eaexec "Set <m-e>=\ee"Inoremap<M-e> <esc>EAexec "Set <m-e>=\ee"Set Ttimeout Ttimeoutlen=100
According to this principle, all kinds of shortcuts in various modes are set up the same way
Reference: How to correctly use Alt mapping in VIM
Improved VIM experience: Move the cursor in insert mode, I don't want to use the arrow keys! Alt shortcut key use Tips!