Vim: How to handle newlines when storing multiple commands in registers?
Posted
by UncleZeiv
on Stack Overflow
See other posts from Stack Overflow
or by UncleZeiv
Published on 2010-04-28T15:32:58Z
Indexed on
2010/04/30
14:17 UTC
Read the original article
Hit count: 174
I have a file where I store snippets of vim commands. When I need a snippet, I yank it and then execute it with @"
. The snippets are stored as a script, one line per command, like this:
:s/foo/bar/g
:echo "hello"
:s/1/2/g
Edit: I removed normal mode commands from the example, as they were not part of the problem.
Now this procedure doesn't work anymore: when executing the snippet, it just stops at the first line as if waiting for a newline.
Is there an option somewhere affecting how @
is executed? I'm pretty sure it was working some time ago...
Substituting the newline with a ^M character works but makes the file more difficult to handle.
Additional information:
Here's another symptom: when I yank a snippet, if I execute it with @"
it stops at the first line as I just explained. But if I execute it with :@
it works. But the help file doesn't seem to imply any difference in how the two commands treat the register's content...
© Stack Overflow or respective owner