Skip to main content
deleted 795 characters in body
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?

deleted 325 characters in body
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.


I think I found a workaround with:

    autocmd QuickFixCmdPost l* nested call timer_start(100, 'Lh_lwindow')

and:

fu! Lh_lwindow(id) abort
    lwindow
    setlocal nowrap
    redraw!
endfu

It delays the execution of the command :lwindow for 100ms. It seems to work.

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.


I think I found a workaround with:

    autocmd QuickFixCmdPost l* nested call timer_start(100, 'Lh_lwindow')

and:

fu! Lh_lwindow(id) abort
    lwindow
    setlocal nowrap
    redraw!
endfu

It delays the execution of the command :lwindow for 100ms. It seems to work.

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.

added 233 characters in body
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.


I think I found a workaround with:

    autocmd QuickFixCmdPost l* nested call timer_start(100, 'Lh_lwindow')

and:

fu! Lh_lwindow(id) abort
    lwindow
    setlocal nowrap
    redraw!
endfu

It delays the execution of the command :lwindow for 100ms. It seems to work.

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.

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 :lhelpgrep command.

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 :lwindow.

According to :h QuickFixCmdPre, 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 :lwindow with :lopen, the previous command :lh autocmd raises the following error:

Error detected while processing QuickFixCmdPost Auto commands for "l*":
E776: No location list

It seems :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?


Thanks to Sato Katsura, I've realised that I was wrong, :lh does not populate the location list after the QuickFixCmdPost event, but before like it should.
The problem is that :lh (contrary to :lvim) creates a help window to which the location list window is associated.
And maybe when :lwindow is executed, I'm still in the original window (the one in which I type the command). But this window has no location list, which is why the autocmd doesn't work as expected.
In other words, :lwindow is executed too soon, I need to find a way to delay its execution until the help window is entered.


I think I found a workaround with:

    autocmd QuickFixCmdPost l* nested call timer_start(100, 'Lh_lwindow')

and:

fu! Lh_lwindow(id) abort
    lwindow
    setlocal nowrap
    redraw!
endfu

It delays the execution of the command :lwindow for 100ms. It seems to work.

added 708 characters in body
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30
Loading
deleted 80 characters in body
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30
Loading
added 12 characters in body
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30
Loading
added 132 characters in body
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30
Loading
Source Link
user9433424
  • 6.2k
  • 2
  • 21
  • 30
Loading