Skip to content

Instantly share code, notes, and snippets.

@eiro
Last active September 21, 2019 11:55
Show Gist options
  • Save eiro/6c7ca797234a103d71e38eaefca3a370 to your computer and use it in GitHub Desktop.
Save eiro/6c7ca797234a103d71e38eaefca3a370 to your computer and use it in GitHub Desktop.
a viml debugger? (bd adding extra "ghost" lines in my registers)
ehllo people,
using vim 8.1.1401 (provided by debian), i wanted to write
a plugin to highlight the covered and uncovered parts
of a golang code.
this is a sample of the cover.out file:
mode: set
github.com/libretro/ludo/input/input.go:53.43,54.34 1 0
github.com/libretro/ludo/input/input.go:55.22,56.115 1 0
github.com/libretro/ludo/input/input.go:57.25,58.71 1 0
now the expected command as i originaly wrote it is
1 command GoCrazy exec 'new +set\ buftype=nofile\ bufhidden=hide\ noswapfile'
2 \| r cover.out
3 \| %v/\v.*:(\d+)\.(\d+),(\d+)\.(\d+) \d+ (\d+)$/d
4 \| %s!!\5 start=/\\%\1l\\%\2c/ end=/\\%\3l\\%\4c/!
5 \| %s!^0!syn region Uncovered!
6 \| %s!^1!syn region Covered!
7 \| %y z
8 \| bd
9 \| exec @z
there is this error message:
Screen mode setting not supported
so obviously: the first line of the cover.out isn't removed (as i
expected at line 3). so i removed the line 8 of my code and now i can
see the buffer
syn region Uncovered start=/\%53l\%43c/ end=/\%54l\%34c/
syn region Uncovered start=/\%55l\%22c/ end=/\%56l\%115c/
syn region Uncovered start=/\%57l\%25c/ end=/\%58l\%71c/
which is correct. also, the content of @z complies to the buffer
content. i repeatidly toggled the bd from the macro and my conclusion
is weird: the bug appears when bd is made by the command. so i verified this using
those 3 separed commands and they work like a charm:
command GoCrazy1 exec 'new +set\ buftype=nofile\ bufhidden=hide\ noswapfile'
\| r cover.out
\| %v/\v.*:(\d+)\.(\d+),(\d+)\.(\d+) \d+ (\d+)$/d
\| %s!!\5 start=/\\%\1l\\%\2c/ end=/\\%\3l\\%\4c/!
\| %s!^0!syn region Uncovered!
\| %s!^1!syn region Covered!
\| %y z
command GoCrazy2 bd
\| hi Covered ctermbg=green
\| hi Uncovered ctermbg=red
\| exec @z
command GoCrazy exec 'GoCrazy1'|exec 'GoCrazy2'
this doesn't make sense to me so i come here to know if there is a viml
debugger where i can see the evolution of the buffer step by step and
chase for the gilty even/macro/callback. also any other help/idea is
welcome.
regards
marc
ps: i know the problem is already solved in other scripts but i try to
maintain my viml codebase as short and maintainable as possible so i
almost don't use extra plugins (exceptions like racer, gitgutter, fugitive
and info).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment