Monday, March 23, 2015

Re: How to execute Vim commands from commands.vim file to my text mydata.txt file?

Thanks a lot. Now I see commands.vim should only contain:
=========
:%s/ship/vessel/ge
:%s/What/That/ge
=========

without:
=========
for line in getline(1, 2)
let @a = line
@a
endfor
=========

I found above code on web, but if I understand correctly the data AND vim code was in the same file, but in my case I would like to have this two separated.


Excellent, just for reference if someone reads this thread... Now I can do the following:
1. Type in commands in commands.vim and have data in mydata.txt.
2. From shell I can execute:
vim -c "source commands.vim" -c wq mydata.txt
Above command executes commands written in commands.vim against mydata.txt text file, saves and exit (wq) the Vim. So I can automate this execution from batch file from schedule for example.

Thanks a lot for help.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: