Thanks to stackoverflow for this one.
:g/^$/d will delete all blank lines in a file
Why? Because :g will execute a command on lines which match the regex and :d deletes :)
Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts
Thursday, January 27, 2011
Put the results of a command in the current vim buffer
:r will read a file into the current buffer in vim
:! will execute a command
You can use them together to read the results of a command and put them in the current buffer
:! will execute a command
You can use them together to read the results of a command and put them in the current buffer
e.g. :r ! ls -1 /home/user/directory | sort -r
Subscribe to:
Posts (Atom)