Hi Suresh, On 4/27/06, Suresh Govindachar <[EMAIL PROTECTED]> 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? >
In Vim7, you can use the readfile() function: let l = readfile("foo.bat") This returns a List with an entry for each line in the file. - Yegappan