Vim Tips Wiki
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
Vim Tips Wiki
1,649
pages
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
Editing
Debug unexpected option settings
Back to page
Edit
Edit source
View history
Talk (0)
Edit Page
Debug unexpected option settings
We recommend that you
log in
before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your
Watchlist
.
Creating an account
is quick and free.
The edit appears to have already been undone.
Anti-spam check. Do
not
fill this in!
{{TipNew |id=1588 |previous=1587 |next=1589 |created=2008 |complexity=basic |author=Metacosm |version=7.0 |subpage=/200802 |category1=Getting started |category2=Plugin |category3=Troubleshooting }} ;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 <code>:scriptnames</code> 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 <code>:verbose [option]?</code> (eg <code>:verbose set tabstop?</code> or <code>:verbose autocmd BufEnter</code>) 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 (<code>:map</code>, <code>:abbreviate</code>, <code>:function</code>, <code>:autocmd</code>, ...) 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=== <pre> gvim -u NONE -U NONE </pre> '''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=== <pre> gvim --noplugin </pre> '''Issue still occurs:''' config setting (vimrc or gvimrc). Try disabling parts of your rc files to see if it still happens. This can be done by commenting out commands, or using a "finish" command in strategic places. Using "finish" allows you to do an easy binary search, letting you narrow down a 2000 line .vimrc in only 10 or so steps. Start by placing a "finish" statement about halfway through your .vimrc. If the problem goes away, it is caused by something in the second half. Otherwise, in the first half. Remove the old "finish" statement, and place a new one halfway through the "bad" half until you find the problematic setting, autocmd, mapping, etc. A method that can help with this search is to set marks (for example, by pressing "ma" and "mb") at the first and last line of the "bad" region. Then do <code>:exec (line("'a")+line("'b"))/2</code> to jump to the halfway point where you can insert your "finish" statement. Update the a or b mark based on the result and continue the process with the same command. '''Issue is fixed:''' it's an installed plugin. Narrow down which one, by disabling individual plugins until it's fixed. This is easiest using a binary search, especially if you are using a plugin manager. Simply remove or disable half your plugins. If the problem is fixed, it's in the half you removed. Otherwise, it's in the half you kept. Continue disabling or removing half of the "bad" group until you find the plugin causing the issue. This lets you search over a hundred plugins in only 7 or so steps. Alternatively, start Vim with <code>--noplugin -D</code> 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 <code>gui</code> 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: <pre> mkdir ~/bak mv .*vim* ~/bak </pre> ==References== *{{help|:verbose}} *{{help|-u}} *{{help|-U}} *{{help|--noplugin}} ==Comments== ===Extra=== <pre> :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 </pre> Might include above somewhere later. [[User:JohnBeckett|JohnBeckett]] 08:21, August 9, 2011 (UTC)
Summary:
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Help
(
view source
)
Template:Navigation
(
view source
)
Template:TipNew
(
view source
)
Follow on IG
TikTok
Join Fan Lab