For example, I used two very popular plug-ins NERDTree and Tagbar in vim. Generally, after I open the editor, I will open the two plug-ins at the same time. It is very troublesome to type twice each time. I wonder if I can combine them into one command, for example
dev, to achieve the following effect, I input in vim
It is executed by default
TagbarOf these two commands, php here is one of mine
Write a function.func! Devphp() if &filetype == 'php' exec "NERDTree" exec "Tagbar" endif endfunc :command -range=% DEVPHP :call Devphp()
The code has not been tested, please modify it a little.
In addition, you can set the default open for nerdtree:autocmd vimenter * NERDTree