Hdi2u S15
Text editing
- There are very many text editors, but one of the most powerful and dependable is
vi
. - It has a steep but tiny learning curve, which we hope to conquer in this section.
- "vi" is an old version and is available on all Unix/linux systems by default
- Vim is the modern version, it used
ncurses
to use the whole screen - It's free and has graphical version call gvim and a Windows version too.
Using vim
- type
vim
to get in, and:q
to get out without saving. -
ZZ
to save onto to current filename. ":sav fname" otherwise - It opens in "normal" mode which is similar to less, in that direct editing is not expected.
- This is changed by pressing
i
. To get back to normal mode, press theESC
key. - In normal mode
u
undoes any changes -
:
while in normal mode allows command sto be entered - Visual: enabled by "v" or "V" (visual block), sub-box at the bottom open.
- After v or V, movement keys ":%" will operate on whole document, ":’a,’b" operate between two marks, ":42,45" between two line numbers
- search via "/", ":set hlsearch" to see all the hits