Vim Tips Wiki
Register
Advertisement

Previous TipNext Tip

Tip: #557 - Opening several files in vim via ListFile

Created: September 16, 2003 5:40 Complexity: intermediate Author: Alex J. Version: 5.7 Karma: 3/4 Imported from: Tip#557

Suppose You want to open several files in vim, but the names of the files to open are stored in a file, each file name on separate line. This is the case with Total Commander, when You open a program and pass it %L as a parameter.


It is possible to do it like that:


gvim "+gl/^/exec 'badd '.getline('.')" +bdel +nohls +"cd %:h" LISTFILE


where LISTFILE contains list of file names to open.


For abovementioned Total Commander, I create new item in "start menu", and assign a shortcut, let's say CTRL+ALT+F4 to it. Set path\gvim.exe as a command.


This is what i put in a "parameters" section:


"+gl/^/exec 'badd '.getline('.')" +bdel +nohls +"cd %%:h" %L


Then I can select several files, press CTRL+ALT+F4 and load all of them into my favourite text editor :)

Comments

try:

gvim -c ":args `type mylist`"

FWIW, things like: gvim *\2*\xx.txt

work too, even with my w2k.

Anonymous , September 26, 2003 10:15


Advertisement