:new|r foo.bat|1d|normal "ayG|q!

So why does the q! get lost,

Well, the ":normal" command swallows everything after it, so
the "pipe cue bang" is interpreted as commands to execute in
normal mode.  You can work around that either by using the
exec command:

        1d|exec 'normal "ayG' | q!

or possibly by dealing with it in normal mode

        1d| normal "ayG:q!<cr>

and is there a better way?


While there are likely a whole mess of ways to skin a cat, one that occurs to me that you can also use:

        :let @a=system('cat foo.bat')

(or on Win32, you might be able to use "type" instead of "cat") It's a little less cryptic.

HTH,

-tim







Reply via email to