I've been an avid Vim user, and recently became interested in how it works.
Does anyone know if there's a tutorial that goes over basics of converting a normal text editor to have Vi/m capability? The programming language does not matter; I'm quite an experienced programmer.
I have found the following resources so far:
TL;DR – How to Exit Vim If you made some changes and would like to keep them, type :wq and press Enter / return. If you made some changes and would rather discard them, type :q! and press Enter / return.
Exit Vim Using a Shortcut Key In addition to command mode, Vim also has the option for shortcut keys: To save a file in Vim and exit, press Esc > Shift + ZZ. To exit Vim without saving, press Esc > Shift + ZX.
I think first you should know that VI/VIM are actually two parts. One is the visual editor called vi
and the other on is the one-liner editor called ed
.
Actually vi
is called visual editor because it's built on top of ed
(editor). It is the visual part of the ex mode, where you can see and edit your text, that's why it get the name vi from visual.
The ex mode is actually a replication/representation of the editor ed
. Just fire up ed
on the terminal and use your default Vi ex commands. The visual, replace and insert modes are used by vi
. For example there are several commands that are actually doing the same thing, for example:
:100 // Go to line 100, ex mode (ed)
100G // Go to line 100, normal mode(vi)
:.,5d // Delete 5 lines, ex mode (ed)
5dd // Delete 5 lines, normal mode (vi)
and so on...
For more information on that I recommended to read the excellent book Learning the vi and Vim editors from O'Reilly:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With