Do not blame admins (or in general users, too) of using nano (pico) it is away too simple for simple tasks, which are probably the most cases under console.
-
- Save a file – press Esc key, then press and hold SHIFT and then press colons “:”, the bottom line of your screen will change and will start with colons “:”, then type the key “w” and then hit Enter key, so you’ve just saved the opened file.
-
- press Esc
- press and hold SHIFT
- press the key with colons “:“
- type “w“
- hit Enter key
-
- Save a file and quit – press Esc key, then press and hold SHIFT and then press colons “:”, the bottom line of your screen will change and will start with colons “:”, then type the key “x” and then hit Enter key, so you’ve just saved the opened file.
-
- press Esc
- press and hold SHIFT
- press the key with colons “:“
- type “x“
- hit Enter key
-
- Save all opened files – press Esc key, then press and hold SHIFT and then press colons “:”, the bottom line of your screen will change and will start with colons “:”, then type the key “wa” and then hit Enter key, so you’ve just saved the opened file.
-
- press Esc
- press and hold SHIFT
- press the key with colons “:“
- type “wa“
- hit Enter key
-
- Quit without saving, just quit the vim – press Esc key, then press and hold SHIFT and then press colons “:”, the bottom line of your screen will change and will start with colons “:”, then type the key “q!” and then hit Enter key
-
- press Esc
- press and hold SHIFT
- press the key with colons “:“
- type “q!“
- hit Enter key
-
- Save a file – press Esc key, then press and hold SHIFT and then press colons “:”, the bottom line of your screen will change and will start with colons “:”, then type the key “w” and then hit Enter key, so you’ve just saved the opened file.
- Enable auto save with two ESC keys – create or edit file
~/.vimrc
Add the following line:
map <Esc><Esc> :w<CR>
* The Esc can be avoided
The escape key can be replaced with pressing and holding CTRL and pressing “[” (left square bracket) = “CTRL+[” and if your “[” is hard typing, you can try CTRL plus “c” = “CTRL+c”, all this is needed to be sure you are not in vim’s insert mode. Avoiding Esc – escape button could be useful under not qwerty keyboards of the mobile devices – smartphones, tablets and so on.
One thought on “vim – edit, save and exit, it is too simple!”