Hdi2u S15

From wiki
Revision as of 22:35, 19 April 2017 by Rf (talk | contribs) (Created page with "= Text editing = * There are very many text editors, but one of the most powerful and dependable is <code>vi</code>. * It has a steep but tiny learning curve, which we hope t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 the ESC 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