Vim Tips Wiki
Register
Advertisement
Tip 557 Printable Monobook Previous Next

created September 16, 2003 · complexity intermediate · author Alex J. · version 5.7


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 %L as a parameter.

It is possible to do it like this:

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

where LISTFILE contains the list of file names to open.

Using 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`"

You can also use commands like the following, even on Windows:

gvim *\2*\xx.txt

Advertisement