Reputation: 17850
I need exactly the opposite behavior of this question. My observation is that upon pressing enter
on a line in location list window, the window will be closed and the main window will display the content of the selected file. As a contrary, quickfix window doesn't have this behavior, i.e., it remains opened after the selection.
I have checked my autocmd and there is no special handling for location list or quickfix list.
An example - :lgrep hi *
to populate the location list. lopen
to open the location list window. Press enter
on any line.
Upvotes: 3
Views: 1939
Reputation: 41
Use :cw to get quickfix window. It will appear horizontally split to current window. and :ccl to return back to selected result
Upvotes: 0
Reputation: 45107
Syntastic by default closes the location list window when no errors are present. Therefore if you use something like :lgrep
which does not mark any of the results as errors then the location-list window will close once you leave the location-list window, e.g. like using <cr>
to jump to a location.
Syntastic provides a way to tweak this via g:syntastic_auto_loc_list
variable. Setting this to 0
will disable the auto-close functionality.
Set the following in your vimrc
file:
let g:syntastic_auto_loc_list = 0
To learn more about this variable see: :h 'syntastic_auto_loc_list'
.
Often the easiest way to test if your vimrc
or a plugin is causing problem is it compare the functionality to a vanilla vim config (or at least more vanilla). Do this by starting up Vim without a vimrc. I use the following invocation:
vim -N -u NONE
Once you have started up Vim in this manner you can test for you bug and see if it is present.
:h :help
, :h :helpgrep
, and :h bug-reports
vimrc
or plugin. This often means you need to disable portions of your vimrc/plugins to try and find the culprit. A fast way is to use a binary search.:verbose
Often a bug is easier to track down directly by using :verbose
to see where something was last set. (See :h :verbose
)
:verbose nmap <leader>foo
. See :h :map-verbose
and :h map-listing
.:verbose set shiftwidth
. See :h :set-verbose
.:verbose autocmd BufEnter
. See :h :autocmd-verbose
and :h autocmd-list
.'verbosefile'
Another way to debug something is to use 'verbose'
/:verbose
and 'verbosefile'
to effectively log what Vim is doing.
Example of using :verbose
and 'verbosefile'
to debug your bug.
:lgrep
command:lopen
'verbosefile'
via :set verbosefile=~/verbose.txt
:15verbose normal <c-v><cr>
:sp ~/verbose.txt
close
or lclose
in your caseautocmd
or function that is causing the closing.autocmd
look to revise it.:scriptnames
to figure out which file the is associated with script local functions. See :scriptnames
and :h <SID>
.I find using Tim Pope's scriptease.vim makes this process easier by providing the :Verbose
command which will setup 'verbosefile'
for you as well as open it right afterwards in the preview window. Scriptease also provides a nice wrapper around :scriptnames
via :Scriptnames
. In general scriptease.vim provides many helpful methods to debugging and reloading plugins.
:h 'syntastic_auto_loc_list'
:h syntastic
:h -u
:h -N
:h :help
:h :helpgrep
:h bug-reports
:h :map
:h map-listing
:h :set
:h set-option
:h :set-verbose
:h :autocmd-verbose
:h autocmd-list
:h 'verbose'
:h :verbose
:h 'verbosefile'
:h :scriptnames
:h <SID>
:h :normal
:h c_CTRL-V
Upvotes: 7