Settings to automatically open and close the QuickFix window when using errormaker.vim

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.

Screen Shot 2013-07-04 at 2.12.51.png

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 ..)

Things that are troublesome at this rate

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.

So

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

Settings to automatically open and close the QuickFix window when using errormaker.vim
What to do when only the window is displayed and nothing is displayed in pygame Note
Initial settings when using the foursquare API in python
I became horror when I tried to detect the features of anime faces using PCA and NMF.
DEBUG settings when using Django
When using if and when using while
Automatically acquire the operation log in the terminal when logging in to Linux
How to get followers and followers from python using the Mastodon API
What to do when the jupyterlab extension settings are not reflected
Settings to be made when starting up the linux server centos7