All Projects → bfrg → vim-qf-preview

bfrg / vim-qf-preview

Licence: other
Preview the quickfix item under the cursor in a popup window

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to vim-qf-preview

vim-jqplay
Run jq interactively in Vim
Stars: ✭ 56 (+75%)
Mutual labels:  vim-plugin, vim-ftplugin
tabnine-vim
Vim client for TabNine. https://vimawesome.com/plugin/tabnine-vim
Stars: ✭ 652 (+1937.5%)
Mutual labels:  vim-plugin
vim-backscratch
Small scratches for Vim, feels nice
Stars: ✭ 20 (-37.5%)
Mutual labels:  vim-plugin
nerdtree-visual-selection
Defines commands that will work on files inside a Visual selection
Stars: ✭ 48 (+50%)
Mutual labels:  vim-plugin
YankAssassin.vim
Don't let the cursor move while Yanking in Vim/Neovim
Stars: ✭ 50 (+56.25%)
Mutual labels:  vim-plugin
vim-ormolu
Plugin for formatting Haskell source code
Stars: ✭ 35 (+9.38%)
Mutual labels:  vim-plugin
gentoo-syntax
[MIRROR] Gentoo Ebuild, Eclass, GLEP, ChangeLog and Portage Files syntax highlighting, filetype and indent settings for Vim
Stars: ✭ 22 (-31.25%)
Mutual labels:  vim-plugin
vim
📝 minimalistic vimrc based on KISS principle @vim
Stars: ✭ 46 (+43.75%)
Mutual labels:  vim-plugin
bufstop
Fast and efficient buffer switching for Vim
Stars: ✭ 82 (+156.25%)
Mutual labels:  vim-plugin
stan-vim
A Vim plugin for the Stan probabilistic programming language.
Stars: ✭ 41 (+28.13%)
Mutual labels:  vim-plugin
vim-bettergrep
A better way to grep in vim.
Stars: ✭ 15 (-53.12%)
Mutual labels:  vim-plugin
vim-tmuxlike
A vim plugin that mimics the actions of tmux. 像操作Tmux一样操作Vim
Stars: ✭ 20 (-37.5%)
Mutual labels:  vim-plugin
VimConfig
Configuration files for Vi-IMproved.
Stars: ✭ 23 (-28.12%)
Mutual labels:  vim-plugin
vim-nicomment
[Unmaintained] Flow comments on your Vim
Stars: ✭ 16 (-50%)
Mutual labels:  vim-plugin
vim-eightheader
Vim plugin: Easily create custom headlines, foldtext, toc, etc
Stars: ✭ 17 (-46.87%)
Mutual labels:  vim-plugin
gh.vim
Vim/Neovim plugin for GitHub
Stars: ✭ 149 (+365.63%)
Mutual labels:  vim-plugin
mpi
minimal (n)vim plugins - icons (Under 200 LOC)
Stars: ✭ 32 (+0%)
Mutual labels:  vim-plugin
vim-goyacc
Vim filetype support for goyacc
Stars: ✭ 22 (-31.25%)
Mutual labels:  vim-plugin
vim-gol
Vim plugin that turns your text into Game of Life world
Stars: ✭ 15 (-53.12%)
Mutual labels:  vim-plugin
vim-js-file-import
Import/require files in javascript and typescript with single button!
Stars: ✭ 130 (+306.25%)
Mutual labels:  vim-plugin

vim-qf-preview

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

Requirements

Vim >= 8.1.2250

Usage

Quickfix window mapping

To avoid conflicts with other plugins no default key mapping for opening the popup window is provided. You will first have to bind <plug>(qf-preview-open) to a key-sequence of your choice.

For example, to open the popup window with p, add the following to ~/.vim/after/ftplugin/qf.vim:

nmap <buffer> p <plug>(qf-preview-open)

Or alternatively, if you prefer to keep your plugin settings in your vimrc:

augroup qfpreview
    autocmd!
    autocmd FileType qf nmap <buffer> p <plug>(qf-preview-open)
augroup END

Now navigate the cursor in the quickfix window 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 popup window.

Popup window mappings

The following default popup mappings are provided:

  • Scroll up/down one text line: Ctrl-k, Ctrl-j
  • Scroll to first/last line of displayed buffer: Shift-Home, Shift-End
  • Scroll back to error line ("reset"): r
  • Close the popup window: q, Ctrl-c

Configuration

b:qfpreview and g:qfpreview

The default popup key mappings and the appearance of the popup window can be configured through the variable b:qfpreview in after/ftplugin/qf.vim, or alternatively through the global variable g:qfpreview. The variable must be a dictionary containing any of the following entries:

Entry Description Default
top Scroll to the first line of the buffer. "\<S-Home>"
bottom Scroll to the bottom of the buffer. "\<S-End>"
scrollup Scroll window up one text line. "\<C-k>"
scrolldown Scroll window down one text line. "\<C-j>"
halfpageup Scroll window up one half page. none
halfpagedown Scroll window down one half page. none
fullpageup Scroll window up one full page. none
fullpagedown Scroll window down one full page. none
reset Scroll window back to error line. "r"
close Close the popup window. "q"
next Navigate to next quickfix item in current list. none
previous Navigate to previous quickfix item in current list. none
height Number of text lines to display in the popup window. 15
offset Number of buffer lines to show above the error line. 0
number Enable the 'number' column in the popup window. v:false
sign Place a sign on the error line in the displayed buffer.¹ {}
matchcolumn Highlight column of current quickfix item in popup window. v:false

¹For valid sign attributes see :help qfpreview.sign and the examples below.

Highlighting

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

Examples

  1. Override the popup scrolling keys:
    let g:qfpreview = {
        \ 'top': g,
        \ 'bottom': G,
        \ 'scrollup': 'k',
        \ 'scrolldown': 'j',
        \ 'halfpageup': 'u',
        \ 'halfpagedown': 'd',
        \ 'fullpageup': 'b',
        \ 'fullpagedown': 'f',
        \ 'next': 'n',
        \ 'previous': 'p'
        \ }
  2. Place a sign in the buffer at the error line and highlight the whole line using CursorLine:
    let g:qfpreview = {'sign': {'linehl': 'CursorLine'}}
  3. Instead of highlighting the whole line, display a sign in the 'signcolumn':
    let g:qfpreview = {'sign': {'text': '>>', 'texthl': 'Search'}}
  4. Same as 3., but also enable the 'number' column. In this case the placed sign is shown in the 'number' column:
    let g:qfpreview = {'number': 1, 'sign': {'text': '>>', 'texthl': 'Todo'}}

Screenshots of 2., 3. and 4.: out

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 | quit'

Note: The directory name git-plugins is arbitrary, you can pick any other name. For more details see :help packages. Alternatively, use your favorite plugin manager.

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].