Skip to content
Vim plugin to preview current quickfix item in a popup window (Vim only)
Vim script
Branch: master
Clone or download
Latest commit 1439b38 Sep 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
after/ftplugin Check for minimum Vim version Sep 3, 2019
autoload Allow users to change key bindings and height Sep 4, 2019
doc Allow users to change key bindings and height Sep 4, 2019
.gitignore Initial commit Aug 31, 2019
README.md Scale image in README.md Sep 6, 2019

README.md

vim-qf-preview

A plugin for the quickfix and location list windows to quickly preview the file with the quickfix item under the cursor in a popup window.

Note: Plugin requires at least Vim 8.1.1705.

The popup window will always have the same width as the quickfix window. Live demo.

Usage

In the quickfix window navigate the cursor to the desired error and press p to open a popup window with the file containing the error. The window is scrolled such that the buffer line with the error is at the top of the window.

Press Ctrl-j or Ctrl-k to scroll the popup window down or up, respectively.

Pressing gg or G will scroll to the top or bottom of the displayed buffer, respectively.

Press x, or move the cursor in any direction to close the popup window.

Mouse events

While the mouse pointer is on the popup window, mouse scroll events will cause the text to scroll up or down as one would expect. Click on X in the top right corner to close the window.

Configuration

b:qfpreview

The default key mappings and the height of the popup window can be changed through the variable b:qfpreview in qf.vim. The following Dictionary keys are supported: scrolldown, scrollup, close, and height.

Examples:

  • Scroll up with Ctrl-y, and scroll down with Ctrl-e:

    " in after/ftplugin/qf.vim
    let b:qfpreview = #{scrolldown: "\<C-e>", scrollup: "\<C-y>"}
  • Scroll up with K, and scroll down with J, close popup window with Esc:

    " in after/ftplugin/qf.vim
    let b:qfpreview = #{scrolldown: 'J', scrollup: 'K', close: "\<Esc>"}
  • Show 20 text lines in the popup window:

    " in after/ftplugin/qf.vim
    let b:qfpreview = #{height: 20}
  • Alternatively, use a global-variable in your vimrc:

    let g:qfpreview = #{scrolldown: "\<C-e>", scrollup: "\<C-y>", close: "\<Esc>"}

Highlighting

The appearance of the popup window can be configured using the highlighting groups QfPreview, QfPreviewTitle, QfPreviewScrollbar and QfPreviewThumb. See :help qfpreview-highlight for more details.

Installation

Manual Installation

Run the following commands in your terminal:

$ cd ~/.vim/pack/git-plugins/start
$ git clone https://github.com/bfrg/vim-qf-preview
$ vim -u NONE -c "helptags vim-qf-preview/doc" -c q

Note: The directory name git-plugins is arbitrary, you can pick any other name. For more details see :help packages.

Plugin Managers

Assuming vim-plug is your favorite plugin manager, add the following to your .vimrc:

Plug 'bfrg/vim-qf-preview'

License

Distributed under the same terms as Vim itself. See :help license.

You can’t perform that action at this time.