When I added a vim plugin, VimAwesome document said that :source %. What does this mean? I'd like to understand % meaning.

3 Answers 3


In vim, % expands to the name (path) of the file opened in the current buffer. In this case, it seems the file in the current buffer is the script that implements VimAwesome.

The :source command will read the file and interpret the VimScript instructions in it, so this command will effectively load the vim plug-in into your current vim session.

  • Thanks for simple answer. In other words, is :source % the same meaning as :source ~/.vimrc in this case?
    – y_natsui
    Commented Sep 2, 2018 at 17:31
  • Yes, that's correct, if ~/.vimrc is the file you have open, then that's what % will expand to.
    – filbranden
    Commented Sep 2, 2018 at 19:49

vim uses vi's keys for the % (current file/buffer) and # (alternate file/buffer).

In any vi-(imitation/emulation/clone) you can use those characters for referring to the current filename and the "other" file. On most terminals/keyboards you can use controlshift6 for switching between current/alternate buffers, although that is not mentioned in POSIX vi. It only goes as far as this:

Non- <backslash>-escaped '%' characters appearing in file arguments to any ex command shall be replaced by the current pathname; unescaped '#' characters shall be replaced by the alternate pathname. It shall be an error if '%' or '#' characters appear unescaped in an argument and their corresponding values are not set.


vi already supported special symbols as shortcuts to certain files in the command-line. Vim builds on top of that; you'll find the information at :help cmdline-special.

The % symbol in particular refers to the current buffer's filespec. There's also an eponymous register (:help quote_%), so you can alternatively insert the value into the command-line via <C-r>%. Or, as the first help topic mentions, you can use this to print the resolved value:

:echo expand('%')

The :source % command, when used on the ~/.vimrc configuration, will reload the config. You can achieve the same effect by quitting and restarting Vim, but this is faster. Note that your Vim configuration needs to be cleanly written for that to work. If not, :autocmds may be duplicated, or you might get errors about existing mappings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .