I have different templates in this directory ~/Documents/Library/
like: Template.cpp, normal.cpp, advanced.cpp
Normally I use this:
autocmd BufNewFile *.cpp 0r ~/Documents/Library/Template.cpp
I want to add an option "choose template" for new files that I create via vim file.cpp
or vim -p file1.cpp file2.cpp
After triggering
vim file.cpp
, Vim will show me multiple options. After choosing one, Vim will use that template.In case of
vim -p file1.cpp file2.cpp
, I want to choose only one for all tabs. Vim will use that template on all tabs.
Is it possible?
if yes, then please help me make this config :)
input
orpopup_menu
for making the selection. Then you have to handleargv()
orv:argv
(to detect-p
) in some kind ofVimEnter
autocommand to decide what to do