On Thu, 27 Apr 2006, Suresh Govindachar wrote:


Hello,

 What's the best way to get the contents
 of a file into a register?  I tried the
 following (file is foo.bat), but it
 doesn't get rid of the new buffer:

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

 So why does the q! get lost, and is there
 a better way?

Do

  :new | r foo.bat | 1d_ | set nonu | redir @a | sil! %p | redir END

"q!" gets lost because :normal reads its argument till the end of the
cmdline.

HTH :)
--
Gerald

Reply via email to