Tuesday, April 24, 2012

Re: How I can run vim commands from a bash script?

vim was not designed for that kind of task.
You can pass commands via -c and --cmd (see --help).

Give this a try:

sed -i 's/foo/bar/' *.txt

-i = write back file "in place"

vim foo will open file name 'foo'.
vim '%/s...' will open file name '%/s...' (and fail)

for x in ..
vim -c "e $x| %s/ ... | wq!"
done

is close to what you requested, but still no proper escaping for
filenames.

Marc Weber

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment