commit 6c9b71bcfe73f7253342e064863a4b6ec498cdfd from: mischa date: Sat Apr 06 16:21:54 2019 UTC add WIP commit - 8ac9e55f46a5b6a69d81ad9952f020a37befca09 commit + 6c9b71bcfe73f7253342e064863a4b6ec498cdfd blob - 06787756a23c0deef59c3f0de65f6debd03f8d40 blob + 6515f6fc0b5fb512753d7d3f5f494ed49633934f --- index.md +++ index.md @@ -1,9 +1,9 @@ -# Why vi Rocks +# Why vi Rocks (WIP) A collection of commands, command sequences in [vi(1)](https://man.openbsd.org/vi.1)/[ex(1)](https://man.openbsd.org/ex.1) or with 3rd party unitilities.
These all work with at least [nvi](https://en.wikipedia.org/wiki/Nvi) 1.79 and 2.1.3 (unicode). -#### Yank / delete an arbitrary number of lines. +#### Yank / delete an arbitrary number of lines 1) mark the first line: mk 2) move to last line @@ -12,11 +12,13 @@ These all work with at least [nvi](https://en.wikipedi 4) move to new line 5) paste with P or p -#### Join all lines in a file +#### Apply regex to an arbitrary number of lines - :%j + 1) mark the first line: mk + 2) mark the last line: ml + :'k,'ls/regex/power/g -#### When you need root permissions to write the file +#### Write file as root :w !doas tee % @@ -26,14 +28,30 @@ These all work with at least [nvi](https://en.wikipedi #### Make a backup of the file on disk - :! cp % %.bak + :!cp % %.bak -#### Sort lines +#### Sort all lines :%!sort -#### Dedup lines +#### Sort paragraph + !}sort + +#### Uniq all lines + :%!uniq +#### Uniq paragraph + !}uniq + +#### Join all lines + + :%j + +#### Select a column (3rd) from formated text seperated by ':' + + :%!awk -F':' '{print $3}' + +