If you use errormaker.vim, which is a plugin of vim, you can run the check command specified at the save timing and manage the result with QuickFix.
For errormaker.vim, the following sites will be helpful when introducing.
For QuickFix, it's faster to look at vim's : help Quickfix
. (I'm not confident to explain it exactly ..)
However, if this is left as it is, the situation of opening the QuickFix window (: copen
command) (Note: often in me) occurs without knowing the error details although the error location is known.
In addition, the QuickFix window once opened must be explicitly closed (: cclose
command).
If the screen is large, you may leave it open, but if you are using screen / tmux or vim's split screen, one area tends to be narrower.
I want the QuickFix window to be displayed = "There is one or more errors", otherwise it is desirable that it is not displayed.
The following settings have been added to the file type plugin to automatically open and close the QuickFix window.
If there is an error when saving the file, the QuickFix window will open automatically → it will close automatically after correction, so you can check for errors comfortably.
vim:~/.vim/after/ftplugin/python.vim
setlocal makeprg=/Users/tatsuro/python/pythonbrew/bin/flake8\ %
setlocal errorformat=%f:%l:%m
""" getqflist()You can get the number of QuickFix errors with.
function! s:open_quickfix_window()
silent make | redraw!
if (len(getqflist()) == 0)
cclose
else
copen
endif
endfunction
if !exists("g:python_flyquickfixmake")
let g:python_flyquickfixmake = 1
au BufWritePost *.py call s:open_quickfix_window()
endif
Recommended Posts