My Vim config includes plugins that try to handle current project, build tags, etc. This is quite useful for my daily programming in Vim, but it's just annoying when I use Vim for some quick edits, like:

  • edit a git commit message;
  • edit a shell command when I type Ctrl+xCtrl+e in zsh or bash;
  • etc.

I don't like the --noplugins either, since I still want to take advantage of some plugins in quick-edit mode, such as surround, easy-motion, and lots of others.

So, I want to have some "light mode" (or "quick mode"), in which some of the plugins will be bypassed, but not all of them.

My first idea was to have some special command-line argument, which I'd parse in vimscript, but quick googling shows that it's currently impossible in vimscript (awful sad, by the way).

My second idea is to set some environment variable when running vim, like this:


This works in git:

$ git config --global core.editor 'VIM_LIGHT_MODE=1 vim'

But if I do EDITOR='VIM_LIGHT_MODE=1 vim', and type Ctrl+xCtrl+e in the shell, it doesn't work:

edit-command-line:13: command not found: VIM_LIGHT_MODE=1

Then I tried this: EDITOR="bash -c 'VIM_LIGHT_MODE=1 vim'", but it fails as well:

vim': -c: line 1: syntax error: unexpected end of file

(To be honest, this one looks particularly weird, it seems I misunderstand how exactly $EDITOR is used, and I'll be glad if someone explains what's going on here)

All other experiments failed as well.

The only hack I can think of is to set some servername, like:

$ vim --servername VIM_LIGHTWEIGHT_MODE

And then check v:servername in vimscript, but this is a total hack: this is not what servername is for, at all.

So is there a cleaner way to achieve what I want?

  • 2
    You can use env: EDITOR='env VIM_LIGHT_MODE=1 vim'. Commented Dec 12, 2015 at 21:16
  • 3
    You can also use another initialization file and run vim as vim -u .vimrc-light. Commented Dec 12, 2015 at 21:23
  • 1
    Oh.. Your both ideas are cool, thanks. And I wasn't aware of env at all, my shell-fu is still too weak. Consider writing it as an answer, so that I'll be able to accept it. Commented Dec 12, 2015 at 21:37

3 Answers 3


There are (at least) two possibilities:

  1. use env:

    EDITOR='/usr/bin/env VIM_LIGHT_MODE=1 vim'
  2. use vim with another initialization file, say .vimrc-light:

    EDITOR='/usr/bin/vim -u ~/.vimrc-light'

While the accepted answer is certainly better, I'd like to discuss EDITOR="bash -c 'VIM_LIGHT_MODE=1 vim'". The problem here is that EDITOR is invoked with arguments, and the arguments passed to bash -c do not get forwarded automatically to vim. You need to use "$@":

EDITOR="bash -c 'VIM_LIGHT_MODE=1 vim \"\$@\"'

However, the first argument after the command in bash -c is $0, which is not part of $@, so you need to use a placeholder argument:

EDITOR="bash -c 'VIM_LIGHT_MODE=1 vim \"\$@\" lightvim' 

With these pitfalls, it's not a good option, but workable nonetheless.


Actually your first idea is possible, in an elegant way too. You can create a user defined command and then call vim with the + syntax.

Just define a custom user command in your .vimrc file like so:

command! CustomUserCommandName AnyVimCommandToExecute

Then from the command line you can start vim like so:

$ vim +CustomUserCommandName

I used this in my .vimrc for easy note taking, like so:

" Note Taking {{{
command! Note execute "normal \<Plug>VimwikiMakeDiaryNote"
command! Notes execute "normal \<Plug>VimwikiDiaryIndex" | execute "normal \<Plug>VimwikiDiaryGenerateLinks"
" }}}

This allows for calling it with thisvim +Note. Then make a shell alias in your shells rc file, to allow even easier calling. In my .bashrc file I alias the above vim commands like this:

alias note="vim +Note"
alias notes="vim +Notes"

Sample solution

In your case you could write something along these lines in your .vimrc file:

command! LightMode let g:lightmode=1

Then test for light mode however you want on per plugin basis or groups of plugins, etc... using a vim if statement similar to this in your .vimrc file:

if exists("g:lightMode")
    " Do something cool with vim 

Things to Note

  • The ! after the vim command command! means that this will overwrite any similarly defined commands with the same name. This is preferable.
  • The CustomUserCommandName MUST have the first letter capitalized
  • You may not want to pollute your global scope with g: you can use s: or any scope that fits your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.