I have the following autocmds to automatically open the quickfix window or the location list window after executing a quickfix command.
augroup quickfix_window autocmd! autocmd QuickFixCmdPost [^l]* nested cwindow | setlocal nowrap | redraw! autocmd QuickFixCmdPost l* nested lwindow | setlocal nowrap | redraw! augroup END
It seems to work except with the
If I type
:lvim /autocmd/ % to look for all the words matching
autocmd inside the current buffer, the location list is populated with all the matches and the location list window is automatically opened (provided there are matches).
But If I type
:lh autocmd to look for the word
autocmd inside the help files, even though the command is run and the location list is populated with results, the location list window is not opened, I have to do it manually with
The pattern is matched against the command being run..
Here the command name is
:lh which begins with the
l character, so it should match the pattern
l* in the 2nd autocmd.
If I replace
:lopen, the previous command
:lh autocmd raises the following error:
Error detected while processing QuickFixCmdPost Auto commands for "l*": E776: No location list
:lh populates the location list after the
QuickFixCmdPost event, instead of before like I expected. Is it normal?
Is there another way to make the location list window automatically opened after
:lh has been run?