Re:Why Atom Can’t Replace Vim – Learning the lesson of vi
by vram22 on Sunday June 01, 2014 @07:34AM
(#7828838)
Edit 2: Also, vim has a built-in sort command:
http://vim.wikia.com/wiki/Sort_lines
, so for the sort example I gave, too, you may not need to shell out to the external sort command. On the other hand, you may want to, since it has more functionality.
Plus, vim doesn't have every filter command that Unix does, so the ! command is still very useful.
Re:Why Atom Can’t Replace Vim – Learning the lesson of vi
by vram22 on Sunday June 01, 2014 @07:28AM
(#7828827)
Edit: After reading the OP, I realized that my example of uppercasing constant definitions, can be simpler with this vim command, which doesn't shell out to the tr command:
gUG
(uppercase U in the command, as opposed to the OP's use of guG - lowercase u).
!Gsort
The ! command can also sort just a range of lines (in place, in the file), which can be even more useful. The range can be selected either by start and end line numbers, as in the parent comment's 2nd example, or by start and end marks (set by ma, mc, etc.) or even by a combination of the two, e.g. starting line number, end mark:
:'a,'b!sort :123,'b!sort
Another example - turn a list of constant definitions in your code, into uppercase:
!Gtr [a-z] [A-Z]
And so on ...