sponsor Vim development Vim logo Vim Book Ad

vim-qf-diagnostics : Highlight quickfix errors, and display error messages in a popup window

 script karma  Rating 1/1, Downloaded by 180  Comments, bugs, improvements  Vim wiki

created by
foo bar
 
script type
utility
 
description
- Highlight the diagnostics (of a project-build, linter, grep) stored in a quickfix list in the buffer and sign column.
- Display the error message for the current line in a popup window next to the cursor.

Popup window:

    <plug>(qf-diagnostics-popup-quickfix) -- Display a popup window at the current cursor position with the error message found for the current line in the quickfix list. If the line contains several errors, all entries are collected and displayed in the same popup window.
    <plug>(qf-diagnostics-popup-loclist) -- Same as above but display the error messages from the current location-list of the current window.

If not all quickfix errors (for the current line) fit into the popup window, a scrollbar will appear on the right side. The popup window can then be scrolled with CTRL-J and CTRL-K, or alternatively, using the mouse wheel. Pressing CTRL-C or moving the cursor in any direction will close the popup window.

Example:

    nmap gh <plug>(qf-diagnostics-popup-quickfix)
    nmap gH <plug>(qf-diagnostics-popup-loclist)


Signs and text highlightings:

The items in the quickfix and location list can be highlighted in the sign column and in the buffer directly. Both highlightings are optional and can be individually configured in g:qfdiagnostics. By default, only signs are placed.

    :DiagnosticsPlace -- Highlight the diagnostics from the current quickfix list.
    :LDiagnosticsPlace -- Same as :DiagnosticsPlace but use the current location list of the current window.
    :DiagnosticsClear -- Remove the highlightings placed by :DiagnosticsPlace.
    :LDiagnosticsClear[!] -- Remove the highlightings placed by :LDiagnosticsPlace.
    :DiagnosticsToggle -- Toggle the diagnostics from the quickfix list.
    :LDiagnosticsToggle -- Toggle the diagnostics from the location list.

Notes:

    :DiagnosticsPlace and :LDiagnosticsPlace will first remove any highlightings that have been previously placed by the respective command.
    :LDiagnosticsPlace can be run in multiple windows to simultaneously highlight diagnostics from several location lists.
    :LDiagnosticsClear must always be run in the same window where :LDiagnosticsPlace has been executed to remove the previously placed diagnostics.
    To remove the highlightings of all diagnostics from all location lists at once, run :LDiagnosticsClear!.

Examples:

Toggle the diagnostics of the quickfix and location lists with F7 and F8, respectively:

    nnoremap <F7> <Cmd>DiagnosticsToggle<Cr>
    nnoremap <F8> <Cmd>LDiagnosticsToggle<Cr>

If you want to place the diagnostics automatically after running :make or :lmake, add the following to your vimrc:

    augroup qf-diagnostics-user
        autocmd!
        autocmd QuickfixCmdPost  make  DiagnosticsPlace
        autocmd QuickfixCmdPost lmake LDiagnosticsPlace
    augroup END

https://github.com/bfrg/vim-qf-diagnostics
 
install details
Run the following in the terminal:

    cd ~/.vim/pack/git-plugins/start
    git clone https://github.com/bfrg/vim-qf-diagnostics
    vim -u NONE -c 'helptags vim-qf-diagnostics/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.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-qf-diagnostics.tar.gz 1.0 2021-07-23 8.1 foo bar Initial upload
ip used for rating: 52.15.59.163

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github