I'm switching from the syntastic plugin to the ALE plugin. In syntastic there was an option g:syntastic_auto_loc_list that would automatically open the location list after it had been populated. If all errors were fixed that location list would close automatically again.

I have looked over the ALE documentation but have found no such option, so I tried to do it myself.

Specifically what I want is this:

  • Open the quickfix and location lists automatically when there are any entries or when they have been altered.
  • When opening a list, the list should appear as a horizontal split in the tab that the relevant file is in. Some of my attempts would spam all lists in the first tab, I don't want that.
  • Do not open the qf/loc lists if the buffer is hidden.
  • Close the corresponding list(s) when a buffer becomes hidden or is closed.
  • If the last file is closed and there is a corresponding list open, then vim should quit.
  • If the last file in a tab is closed and there is a list open, that list should close and the tab should be deleted as well.
  • Close the list(s) if they are/become empty
  • Don't open lists for readonly files, nothing I can do about it anyway, so there is no point wasting screen space.
  • When lists are opened, they should never get focus, unless I manually switch to them, so that I don't get interrupted while typing.

I found cwindow and lwindow would show/hide the quickfix/location lists automatically but they need to be invoked. So I tried autocmd. The problem is I can't figure this out at all. Here is what I tried:

augroup AutoCAndLWindow
    autocmd QuickFixCmdPost [^l]* nested cwindow | setlocal nowrap | redraw!
    autocmd QuickFixCmdPost l* nested lwindow | setlocal nowrap | redraw!
augroup END

This doesn't do anything at all. When ALE gets around to populate the list, the window doesn't open.

augroup AutoCAndLWindow
    autocmd InsertEnter,InsertLeave,BufWritePost * cwindow | lwindow
augroup END

This throws an error at me:

Error detected while processing InsertLeave Autocommands for "*":
E776: No location list

I think this is because it tries to open a location list for the quickfix list.

I also want the location/quickfix windows to close when the corresponding buffer is closed or hidden. I like it to work with tabs and splits. I have found a few examples on the internet such as this one, but that throws errors at me when I close a tab with a quickfix open for a file I'm editing.

How do I achieve what I want?

  • Welcome to the site. I can sympathize, I also switched to ALE recently. Syntastic remains one of my favorite pieces of software ever.
    – Friedrich
    Commented Apr 21, 2023 at 7:14

1 Answer 1


I would try the following two options:

let g:ale_open_list = 1
let g:ale_keep_list_window_open = 0
  • 1
    I don't know how I missed that. How embarrassing. Thank you. Sadly this doesn't close the list when the buffer it belongs to is being closed.
    – FalcoGer
    Commented Apr 20, 2023 at 20:49
  • Thanks for the feedback! Welcome to Vim :-) Commented Apr 21, 2023 at 4:02
  • @FalcoGer about the closing issue: it's not really what you ask but maybe something like nnoremap <C-L> :cclose<CR><C-L> may help you. I usually add some more commands and hijack redraw to make all visual clutter go away (the idea to do so is of course stolen from tpope's vim-sensible).
    – Friedrich
    Commented Apr 21, 2023 at 7:23

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.