This is a draft, quarantined as a subpage of my own userpage until (and if) it is ready to face the world. Feel free to edit it.
Say you've got a file containing a list of files which you would like to open.
Let's call this file list.txt. It's contents might be:
~/foo/bar.txt ~/foo/bar2.txt ~/something.pl
The following three commands will allow you to quickly open the files listed:
function s:ReadFileListAndDoSomething (command, file_list) for file_path in readfile(expand(a:file_list)) exe a:command file_path endfor endfunction command -nargs=1 -complete=file ReadBuffers call s:ReadFileListAndDoSomething('badd', <q-args>) command -nargs=1 -complete=file ReadArguments call s:ReadFileListAndDoSomething('argadd', <q-args>) command -nargs=1 -complete=file ReadTabs call s:ReadFileListAndDoSomething('tabedit', <q-args>)
Add the above code to your .vimrc, and you'll be able to load files as buffers using:
Add files to your argument list using:
And to open the files in new tabs using:
This technique can also be used for all sorts of other things - for instance, delete all files listed using the command '!rm'.