Im trying to make a setup where I can

  1. open a vertical split, preferably in the /tmp/ directory in readonly mode(so you cannot write changes)
  2. read the shell output from a linter/compiler (in my case, the program shellcheck)
  3. if required perform a substitution on all the file/line number information to bring to the form : filename:line which allows gF 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>"

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!


2 Answers 2


Writing a compiler plugin allows you to supplement the :make command to run any tool you want, and parse the output into the quickfix window. In your case, I would so something like the following:

" ~/.vim/compiler/shellcheck.vim
if exists('current_compiler')
let current_compiler = 'shellcheck'

if exists(':CompilerSet') != 2
  command -nargs=* CompilerSet setlocal <args>

CompilerSet makeprg=shellcheck\ -f\ gcc

CompilerSet errorformat=%f:%l:%c:\ %t%.%#: %m

Change to shellcheck with :compiler shellcheck.

Then :make % (or :make -options -and any other files*) and use the goodies in :help quickfix to navigate.

ALE can do something similar automatically. It does its own parsing in many cases, which I think is a bug (re-use the errorformat tool! Argh!), but it works well for many tools.


Sounds like you want to use the quickfix window. I only had moderate success with it in python, but it was all configured by a plugin. I also tried a bit with latex files. I never tried to set up vim for bash, so I don't know any plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.