more vi tips
buffers
35 buffers based on 26 letters and 9 numbers.
"a5yy - copy 5 lines in buffer a
"ap - paste buffer a
"4p - paste 4th delete
"r5dd - delete five lines, place in bufffer r
"R2dd - delete 2 lines and APPEND them to buffer r
To copy text from a named buffer preface the p or P (put) command,
aka, "paste", with a double quote and the lowercase letter naming the buffer.
markers
ma - mark block of text for buffer a
d'a - delete from cursor to ma
y'a - copy from cursor to ma
If you type 'a you will move to the location of marker a
To sort a section: mk
!'ksort
to sort a list and then place into three columns:
!'ksort | pr -3tw50
aaaaaa
ccccc
cccc
ddddd
ffff
zzzz
pr option -3 specifies columns,
the -t suppresses the header
and the -w50 causes the output to fit within a page of 50 characters.
more ex
:args - lists file(s) working on
:rew - rewind, when editing multiple files
:w !spell to check spelling in work area
more magic
:set magic - enables * and . for pattern searches
:set nomagic - disables, to use meta characters, escape them (\).
:set wrapscan (ws) - allows wrapping of searches
:set wm-8 (sets margin to 72 characters total)