Is there a "vim runtime log"?

VimRuntimeLogging

Vim Problem Overview


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.

Vim Solutions


Solution 1 - Vim

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

vim -V9myVim.log

would create a log of debug level 9 in the current directory with the filename myVim.log

Solution 2 - Vim

:messages shows all warnings, errors, and informational messages that appeared (possibly briefly) in the vim statusline.

:echo errmsg prints the most recent error message.

g< is another feature few people know about. From :help g<:

> The g< command can be used to see the last page of previous command output. This is especially useful if you accidentally typed <Space> at the hit-enter prompt.

For example try :!ls then cancel the prompt, then hit g<.

Solution 3 - Vim

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.

Solution 4 - Vim

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

Solution 5 - Vim

This probably goes against everything SO stands for, but here's what I do: I just hit print screen soon as the warning comes up and look at the picture.

Solution 6 - Vim

I had to add "set nocp" to use "ToggleVerbose()" function when run in root because of &verbose

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSomebody still uses you MS-DOSView Question on Stackoverflow
Solution 1 - VimsleepynateView Answer on Stackoverflow
Solution 2 - VimJustin M. KeyesView Answer on Stackoverflow
Solution 3 - VimZyXView Answer on Stackoverflow
Solution 4 - VimJayView Answer on Stackoverflow
Solution 5 - VimpukView Answer on Stackoverflow
Solution 6 - VimmasuchView Answer on Stackoverflow