tags:

views:

183

answers:

3

Sometimes I try a customization/command in my vimrc. Everything seens to be correct, but it just doesn't work.

It's difficult to know what's happening when vim starts, and know which command failed or not, so it's really difficult to debug what can be causing a problem in my vimrc. It's a trial-error approach, which is time consuming and really a PITA. For example, I'm having problems with snipmate plugin in some files and just don't have a clue on how to discover the problem.

Is there a "runtime log" when vim starts, telling which commands it executed, which ones failed and such? This would help me a lot.

+1  A: 

I don't think there is a runtime log, per se, but you can run it in debug mode.
http://www.troubleshootingwiki.org/Debugging_Vim_Scripts

Jay
+4  A: 

running vim with the -V[N] option will do a pretty hefty runtime log, here N is the debug level.

vim -V9myVimLog

would create a log of debug level 9 in the current directory with the filename "myvimlog"

sleepynate
I liked both approachs from Zyx and you, but your approach is better in my opinion because it's simpler, only in the cmd, and I can set a path to the log each time I run it, and I don't need to "inflate" my vimrc. And welcome to SO!
Somebody still uses you MS-DOS
Since you're into vim, I have asked other questions as well, if you're interested: http://stackoverflow.com/questions/2999980/how-to-make-a-file-with-pt-extension-with-xml-syntax-highlighting-and-vims-plu Thanks for the anyway for the verbose tip!
Somebody still uses you MS-DOS
+1  A: 

Put this function into .vimrc:

function! ToggleVerbose()
    if !&verbose
        set verbosefile=~/.log/vim/verbose.log
        set verbose=15
    else
        set verbose=0
        set verbosefile=
    endif
endfunction

Then create directory ~/.log/vim and call ToggleVerbose() to get your log in ~/.log/vim/verbose.log. Note that you may catch «variable nested too deep for displaying» error which will not normally appear just because you have raised your verbose level.

ZyX