This commit is contained in:
mischa 2019-04-06 18:21:54 +02:00
parent 8ac9e55f46
commit 6c9b71bcfe

View File

@ -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.<br />
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.wikipedia.org/wiki/Nvi) 1.79 and 2
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.wikipedia.org/wiki/Nvi) 1.79 and 2
#### 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}'