Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #1335 - Running normal mode commands from the command line

Created: September 20, 2006 8:40 Complexity: intermediate Author: Thomas Ibbotson Version: 5.7 Karma: 18/9 Imported from: Tip#1335

I had a problem today whose solution required some trickery, so I decided to write a tip. I had a long list of files open in buffers, and I wanted to do the same thing to all of them, only that thing required the use of some normal commands in the form of a macro.


I recorded the macro into register "a using qa <Do some stuff> q, and I wanted to repeat that for all for the files in the buffer, the solution turned out to be to use this comannd-line command:

bufdo exe "normal @a"

Comments

You can also do

set autowrite

To get files auto-written.

bps7j--AT--yahoo.com , September 20, 2006 12:29


I often take a look at

help :bar

to see which commands see the '|' as their argument.

Anonymous , September 27, 2006 3:12


Save all buffers -> :wall

Anonymous , October 2, 2006 14:47


Advertisement