Is there a “vim runtime log”?

前端 未结 6 835
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-12 10:42

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 st

相关标签:
6条回答
  • 2020-12-12 11:20

    :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<.

    0 讨论(0)
  • 2020-12-12 11:28

    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.

    0 讨论(0)
  • 2020-12-12 11:32

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

    0 讨论(0)
  • 2020-12-12 11:33

    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

    0 讨论(0)
  • 2020-12-12 11:36

    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

    0 讨论(0)
  • 2020-12-12 11:41

    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.

    0 讨论(0)
提交回复
热议问题