-
hipo posted an update 11 years ago
Avoiding Escape key in Vim (emulate Escape) key in VIM editor – Press simultaneously ctrl+[ and hooray you have emulated escape.
This tip discusses how to exit from insert mode without needing to press Esc. You might have ended like me into a vim or crontab -u root -e edit with a vim or vi, entered INSERT or REPLACE mode and the “escape” key is not responding due to terminal setting or temporary OS / keyboard failure, just press CTRL + [ and enjoy. The Vi editor was originally written on an ADM-3A terminal, which had the Escape key positioned where the Tab key occurs on most modern keyboards. Many touch typists appreciate the fact that they can leave their hands on the keyboard home row while using Vim, so there are several ideas for avoiding the Esc key at its current location (pressing Esc generally requires stretching to the top of the keyboard).
No utility programs or operating system tweaks are required for this tip. For other suggestions involving mapping keys with the operating system or utilities, see Map caps lock to escape in XWindows (for Unix-based systems), or Map caps lock to escape in Windows (for Windows). Some of the suggestions involve more than avoiding escape; topics also discussed include using the CapsLock key for Ctrl, and avoiding irritations from accidental use of CapsLock.
Other useful VIM keyboard combinations is if keyboard arrow keys are not working you can emulate keyboard arrows too in vim too with:Alt+o opens a new line below the one you are currently editing
Alt+A appends to the end of the current line,
Alt+p pastes at the current insert location.
Alt+k moves up