Im trying to make a setup where I can
- open a vertical split, preferably in the
/tmp/
directory in readonly mode(so you cannot write changes) - read the shell output from a linter/compiler (in my case, the program
shellcheck
) - if required perform a substitution on all the file/line number information to bring to the form :
filename:line
which allowsgF
to jump to that file and line.
This way my aim is to jump from the split containing the error info to the one containing my code where I can make the changes and jump back and move to the next occurance of file:line
and jump back and so on...
So far I have the following and it works in bringing up the split and all the error info:
function! BashLint()
let curr=expand('%:p')
vert sview /tmp/%.lint
exe "0read ! shellcheck -f gcc " . curr
%s/In \(.*\) line \([0-9]\+\):/\1:\2/e
norm gg
exe "normal " . "/" . curr . "/e+1\<cR>"
endfunction
This works but I cannot jump in between the splits as pressing gF
simply opens the file/linenumber in a new tab. Is there something I can do about this ? I thought about remapping gF
but I don't know how I could approach doing something like that ?
Any thoughts / suggestions to make this better would be greatly appreciated. Thanks!