dcn
dcn

Reputation: 4469

Vim execute command after (multiple) files loaded

Is there an equivalent/workaround to the -c command line parameter of vim that executes a given command after all files have been loaded? My use case is to load multiple files in vim and show the buffer explorer list on startup.

Upvotes: 3

Views: 1408

Answers (1)

holygeek
holygeek

Reputation: 16185

Use the VimEnter autocommand. See :help VimEnter.

In your .vimrc:

au VimEnter * <call the bufexplorer function here>

Or specify it from the command line:

$ vi *.c -c "au VimEnter * BufExplorer"

If you use it often enough make an alias for it (assuming that you're using unix):

$ alias vib='vi -c "au VimEnter * BufExplorer"'
$ vib *.c

Upvotes: 7

Related Questions