You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preview on :helpgrep entries don't work for me. The qf#GetEntryPath(cur_line) doesn't find the help file since only the tail of its name is given.
:pedit allows us to use #{bufnr} to preview an existing buffer. We can get this buffer by querying the entry dictionnary of the current line in cur_list.
--- a/autoload/qf/preview.vim+++ b/autoload/qf/preview.vim@@ -24,8 +24,11 @@ function! qf#preview#PreviewFileUnderCursor()
let cur_list = qf#GetList()
let cur_line = getline(line('.'))
let cur_file = fnameescape(qf#GetEntryPath(cur_line))
+ let cur_ntry = get(cur_list, line('.')-1, {})- if cur_line =~ '|\d\+'+ if !empty(cur_ntry) && bufexists(cur_ntry.bufnr) && cur_ntry.bufnr+ execute 'pedit +' . cur_ntry.lnum . ' #' . cur_ntry.bufnr+ elseif cur_line =~ '|\d\+'
let cur_pos = substitute(cur_line, '^\(.\{-}|\)\(\d\+\)\(.*\)', '\2', '')
execute "pedit +" . cur_pos . " " . cur_file
else
More generally, is there a reason why almost all queries on the entry list is done by parsing getline(line('.')) ? It seems that the location list of the location list is itself, so we can use the power of getloclist(0) and its {what} argument for the quickfix window mappings, like } and {.
Also, qf#PreviewFileUnderCursor() in autoload/qf.vim and qf#preview#PreviewFileUnderCursor() are duplicates. I guess one is for legacy, but we could simply call one of them from the other.
The text was updated successfully, but these errors were encountered:
It seems that the location list of the location list is itself, so we can use the power of getloclist(0) and its {what} argument for the quickfix window mappings, like } and {.
Most of that code predates {what}. In fact vim-qf as a whole is pretty dated, which is a good and a bad thing: it works in older Vims but it is also a bit of a mess that would benefit a lot from newer features. As mentioned in a couple of other discussions, I am considering reviewing the whole thing. The current guards assume 7.3 compatibility but I very much doubt 7.3 or even 7.4 are actually supported so I should probably bump it to 8.0.
Hi again,
Preview on
:helpgrep
entries don't work for me. Theqf#GetEntryPath(cur_line)
doesn't find the help file since only the tail of its name is given.:pedit
allows us to use#{bufnr}
to preview an existing buffer. We can get this buffer by querying the entry dictionnary of the current line incur_list
.More generally, is there a reason why almost all queries on the entry list is done by parsing
getline(line('.'))
? It seems that the location list of the location list is itself, so we can use the power ofgetloclist(0)
and its{what}
argument for the quickfix window mappings, like}
and{
.Also,
qf#PreviewFileUnderCursor()
inautoload/qf.vim
andqf#preview#PreviewFileUnderCursor()
are duplicates. I guess one is for legacy, but we could simplycall
one of them from the other.The text was updated successfully, but these errors were encountered: