Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vimscript - "canonical" way to read file into list?

840 views
Skip to first unread message

enderen

unread,
Mar 11, 2011, 1:24:42 PM3/11/11
to
The following works:

function! FileReadIntoList(file)
let currbuff = bufnr(bufname("%"))
execute 'silent edit ' . a:file
execute 'buffer ' . currbuff
let list = getbufline(bufnr(bufname(a:file)), 1, "$")
execute 'bwipeout ' . a:file
return list
endfunction


but looks a little clumsy to me, is there a more elegant way to do
this?

Mikolaj Machowski

unread,
Mar 11, 2011, 2:01:33 PM3/11/11
to
enderen scripsit:

:help readfile()

m.

0 new messages