9

I am trying to set g:netrw_list_hide and it doesn't seem to work. No matter what I set it to in my .vimrc it always has the value ,^\.\.\=/\=$. Only if I source my vimrc file again, then it holds the correct value.

How do I debug this? I guess there is some plugin that is setting that variable? Possibly after my vimrc gets loaded, so I want to see where it's being set.

  • 2
    :vim netrw_list_hide **/* – romainl Sep 1 '16 at 9:32
  • 3
    currently not really possible apart from inspecting the source manually. I created this PR which would allow this. – Christian Brabandt Sep 1 '16 at 10:07
  • Won't verbose command help in this case? – SibiCoder Sep 1 '16 at 10:27
10

You can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine (search, grep) the vimlog log file for :let g:netrw_list_hide.

10

If you were looking for the last point where an option was set (instead of a variable), you could use the :verbose command:

:4verbose set is?
  incsearch
        Last set from ~/.vim/vimrc

But currently there is no equivalent command for variables.

You could inspect the code, or use search in the source, possibly using :vimgrep, :vim netrw_list_hide **/* (as mentioned in the comments).

Another alternative is to use the 'verbose' option to echo everything that is executed after you set the variable. As it will be an large output echoed in the screen, you will need to save it (into a register, for example):

" in your .vimrc, after you set the variable
redir @b
set verbose=15

After the initialization ends, restore the verbose to the default value and stop the redirection:

:set vbs&
:redir end

You may need to hit Ctrl-C some times, depending on the autocmds/plugins you are using.

Then you can paste contents of the register using "bp and analyze the "initialization log".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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