Is there a way to disable a plugin only on occasions where Vim was launched from another program?
I have set Vim (Neovim, more specifically) to be the default core.editor
of my git configuration and let's say I have these plugins in my .vimrc
loading through vim-plug:
" Plugins to load with Vim
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree' | Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'itchyny/lightline.vim'
Plug 'ryanoasis/vim-devicons'
call plug#end()
" Some variables and vimscripts directly related to a plugin
let NERDTreeShowHidden = 1
autocmd VimEnter * NERDTree | wincmd p
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
In this case, I just want to have a clean buffer ready for me to insert the commit message, so is it possible to make Vim ignore some of these plugins when commiting?
In other words:
- Is Vim capable of understanding that it was launched through
git commit
(or merelygit
)? - Should it be capable, how must I change my
.vimrc
(either on the example above where the plugins are called or somewhere else in the file) in order to disable plugins I don't need?- In this case, anything related to NERDTree is irrelevant when commiting, so
nerdtree
,nerdtree-git-plugin
andvim-devicons
should be disabled whilelightline.vim
will keep getting loaded;
- In this case, anything related to NERDTree is irrelevant when commiting, so
- In case I manage to disable plugins under these circumstances, should I be aware of any further changes in variables and scripts that call upon these disabled plugins (such as the ones shown above)?