Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim execute command after (multiple) files loaded

Tags:

vim

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.

like image 644
dcn Avatar asked Feb 23 '26 15:02

dcn


1 Answers

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
like image 183
holygeek Avatar answered Feb 25 '26 10:02

holygeek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!