Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indentation on verbose tracing #3685

Open
dhduvall opened this issue Dec 11, 2018 · 0 comments
Open

indentation on verbose tracing #3685

dhduvall opened this issue Dec 11, 2018 · 0 comments

Comments

@dhduvall
Copy link
Contributor

While working on fatih/vim-go#2090, I was having a bit of trouble tracking down where &cpo wasn't getting reset properly. I ended up doing this:

$ vim -V99trace.out foo.go
...
$ awk '/cpo/ {
    printf("%*s%s\n", i * 2, "", $0)
}
$0 ~ /^sourcing|^line [0-9]*: sourcing/ && $0 !~ /finished/ {
    printf("\n%*s%s\n", i * 2, "", $0); i++
}
/^finished sourcing/ {
    i--; printf("%*s%s\n", i * 2, "", $0)
}' trace.out

which gave me some nice indented trace output:

sourcing "$VIM/vimrc"

  line 10: sourcing "/usr/share/vim/vim81/debian.vim"
  finished sourcing /usr/share/vim/vim81/debian.vim
finished sourcing $VIM/vimrc

sourcing "$HOME/.vimrc"
  line 9: set cpoptions+=$

  line 130: sourcing "/home/duvall/.vim/autoload/pathogen.vim"
  finished sourcing /home/duvall/.vim/autoload/pathogen.vim

  line 150: sourcing "/usr/share/vim/vim81/filetype.vim"
    line 12: " Line continuation is used here, remove 'C' from 'cpoptions'
    line 13: let s:cpo_save = &cpo
    line 14: set cpo&vim

    line 2121: sourcing "/home/duvall/.vim/bundle/vim-go/ftdetect/gofiletype.vim"
      line 4: let s:cpo_save = &cpo
      line 5: set cpo&vim
      line 63: let &cpo = s:cpo_save
      line 64: unlet s:cpo_save
    finished sourcing /home/duvall/.vim/bundle/vim-go/ftdetect/gofiletype.vim
    line 2159: " Restore 'cpoptions'
    line 2160: let &cpo = s:cpo_save
    line 2161: unlet s:cpo_save
  finished sourcing /usr/share/vim/vim81/filetype.vim

It'd be nice to have something like this built-in to help navigate the rats nest of included vim scripts, though I can understand if it's too specific and finicky to implement generally. In that case, perhaps this issue can serve to document the awk command for others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant