diff --git a/after/ftplugin/qf.vim b/after/ftplugin/qf.vim index 083b6f6..ccefaea 100644 --- a/after/ftplugin/qf.vim +++ b/after/ftplugin/qf.vim @@ -1,6 +1,6 @@ " vim-qf - Tame the quickfix window " Maintainer: romainl -" Version: 0.0.9 +" Version: 0.1.0 " License: MIT " Location: after/ftplugin/qf.vim " Website: https://github.com/romainl/vim-qf @@ -50,6 +50,8 @@ if exists("g:qf_mapping_ack_style") else nnoremap O :cclose endif + " preview entry under the cursor + nnoremap p :call qf#PreviewFileUnderCursor() endif " filter the location/quickfix list diff --git a/autoload/qf.vim b/autoload/qf.vim index 8f512c9..98d0d9f 100644 --- a/autoload/qf.vim +++ b/autoload/qf.vim @@ -1,6 +1,6 @@ " vim-qf - Tame the quickfix window " Maintainer: romainl -" Version: 0.0.9 +" Version: 0.1.0 " License: MIT " Location: autoload/qf.vim " Website: https://github.com/romainl/vim-qf @@ -13,6 +13,15 @@ let s:save_cpo = &cpo set cpo&vim +" open the current entry in th preview window +function qf#PreviewFileUnderCursor() + let cur_list = b:isLoc == 1 ? getloclist('.') : getqflist() + let cur_line = getline(line('.')) + let cur_file = substitute(cur_line, '|.*$', '', '') + let cur_pos = substitute(cur_line, '^\(.\{-}|\)\(\d\+\)\(.*\)', '\2', '') + execute "pedit +" . cur_pos . " " cur_file +endfunction + " helper function " " returns 1 if the window with the given number is a quickfix window " " 0 if the window with the given number is not a quickfix window diff --git a/doc/qf.txt b/doc/qf.txt index 85f8881..184bb9d 100644 --- a/doc/qf.txt +++ b/doc/qf.txt @@ -179,6 +179,7 @@ Ack.vim-inspired mappings available only in location/quickfix windows: t - open entry in a new tab o - open entry and come back O - open entry and close the location/quickfix window + p - open entry in a preview window Add the line below to your vimrc to enable this feature: > diff --git a/plugin/qf.vim b/plugin/qf.vim index 712bf3f..8ce5c53 100644 --- a/plugin/qf.vim +++ b/plugin/qf.vim @@ -1,6 +1,6 @@ " vim-qf - Tame the quickfix window " Maintainer: romainl -" Version: 0.0.9 +" Version: 0.1.0 " License: MIT " Location: plugin/qf.vim " Website: https://github.com/romainl/vim-qf