Vim Tips Wiki

Debug unexpected option settings

Revision as of 04:14, May 16, 2012 by JohnBot (Talk | contribs)

1,619pages on
this wiki
Tip 1588 Printable Monobook Previous Next

created 2008 · complexity basic · author Metacosm · version 7.0

You put that neat new option in your .vimrc, but when you restart Vim, there's no effect! What's up?
Probably, the .vimrc you are editing is not the one that Vim is loading on startup. Execute the command :scriptnames to find out what scripts have been loaded and from where. Make sure the .vimrc appearing there is the one you are changing. For more information on how Vim finds a .vimrc, read :help .vimrc.
Certain the correct .vimrc is being read, and it still doesn't work?
For many Vim customizations (eg tabstop setting, BufEnter autocmd) you can do :verbose [option]? (eg :verbose set tabstop? or :verbose autocmd BufEnter) to find the current values and where they were set. Modelines and scripts which run after .vimrc can trip you up in this way.
You're seeing unexpected maps or abbreviations. Why?
You can use most define commands (:map, :abbreviate, :function, :autocmd, ...) on their own to list all defined maps, abbreviations, ... Or you can use them with the lhs of the definition to list all matching definitions. Some (like map and abbreviate) will allow partial matches. Add verbose in front and you can see where each item is defined.

Narrowing down the problem

If you're encountering something strange, you can try turning off customizations to determine where the strangeness is coming from.

Use default Vim settings

gvim -u NONE -U NONE

Issue still occurs: likely happens in a default Vim install. May be a bug.

Issue is fixed: it's an installed config setting or plugin. Try disabling plugins.

Disable all plugins

gvim --noplugin

Issue still occurs: config setting (vimrc or gvimrc). Try commenting out parts of your rc files to see if it still happens.

Issue is fixed: it's an installed plugin. Try disabling plugins until it's fixed. Or start Vim with --noplugin -D to step through all the startup scripts (this can be tedious). If you are running a GUI version, debugging only starts after the GUI is up. Put a gui command in your .vimrc to fix this; it will start the debugging right after that command, and let you step through .vimrc.

Other notes

Some Vim distributions may include custom settings for Vim (such as debian.vim or Cream's settings) that may make your results different from others.

You might also get slightly different results if you remove your vimfiles. I'm not sure. You can easily stash up all of your vimfiles:

mkdir ~/bak
mv .*vim* ~/bak




:ab              " list abbreviations
:map             " list mappings
:scriptnames     " list scripts

:verbose ab x    " list abbreviations starting with 'x', and where set
:verbose map x   " list mappings starting with 'x', and where set

Might include above somewhere later. JohnBeckett 08:21, August 9, 2011 (UTC)

Around Wikia's network

Random Wiki