4 ms·
Yes, good ones. Running ! commands can also be done in command mode, without using last line mode (those who don't know the difference can see https://gumroad.c
by vram22 10y ago
Yes, good ones. Running ! commands can also be done in command mode, without using last line mode (those who don't know the difference can see https://gumroad.com/products/vi_quick https://gumroad.com/products/vi_quick ). I use variations of commands like this a lot, as needed:
1G (to go to top of file if not already there)
!Gsort (to filter all the lines in the file through the sort command, and replace the file contents with the sorted lines)
which says: filter all the lines would be traversed over as a result of running the G command (which goes to the last line in the file) through the sort command, and use the output of the sort to replace all the lines that were filtered;
sort can be replaced with any other command that is a filter, e.g. fmt, grep, sed, many more;
(note: no need of colon in the above command, just have to be in command mode, not input mode, which you get into by pressing Esc).
Very powerful, just that feature, particularly in programming.