I am trying to write a script that will open a file in vim and copy a specific line into it in one of the vim registers. When you run the script again, it decides to open the file again, and then reinsert the values ββinto the vim registers. In fact, the script should switch the value each time it is run.
For example, suppose I would like to switch the word "foo" to "bar" when I run the script, and then return to "foo" again if I run the script again. I can go to the word foo by doing:
vim '+/foo' myfilename
And I know that when I'm inside vim, I can load 'foo' into the 'q' register by doing
"qyy
But when checking my registers, the following command does not work: reg
vim '+/foo' '+"qyy' myfilename
What am I doing wrong? Thanks!
source share