Skip to main content
21 votes

Make cnext and cprevious loop back to the begining

You can write some commands: command! Cnext try | cnext | catch | cfirst | catch | endtry command! Cprev try | cprev | catch | clast | catch | endtry command! Lnext try | lnext | catch | lfirst | ...
Tommy A's user avatar
  • 6,800
14 votes

Quickfix support for Python tracebacks

Built in compiler plugin pyunit As already suggested by jamessan, one option is to use the built in compiler plugin pyunit: :compiler pyunit :set makeprg=python3\ % :make This has the downside, that ...
siho's user avatar
  • 241
14 votes
Accepted

How to load files as a quickfix window at start-up

Vim has a startup option -q to read a quickfix file. So we have options (depending on your shell): cmd > results vim -q results Or my favorite vim -q <(cmd)
D. Ben Knoble's user avatar
  • 27.3k
13 votes

How to auto fix common linting errors reported via syntastic?

As mentioned in the comments be aware of the consequences this modification has to you work environment (know exactly which eslint rules you use to "fix" things). To answer your question: adding the ...
JepZ's user avatar
  • 231
11 votes
Accepted

autocmd with quickfix window

The parameter for both the WinEnter and BufEnter events are matched against the buffer name, which is empty for the quickfix window: :echo bufname('') [no output] You can still use the buftype ...
Martin Tournoij's user avatar
10 votes
Accepted

How to conceal filename and line number in quickfix window?

You can use the conceal feature for this. Add the following to the file ~/.vim/after/syntax/qf.vim (first creating the file if necessary): syntax match ConcealedDetails /\v^[^|]*\|[^|]*\| / conceal ...
Rich's user avatar
  • 32.4k
10 votes
Accepted

How can I close the quickfix window and go back to the file I was editing

To close the quickfix window, you use :cclose, as @statox mentioned in the comments. This won't affect which code buffer you're viewing, though. Vim doesn't distinguish between the buffer you were ...
Rich's user avatar
  • 32.4k
10 votes

How can I compile cpp using Vim?

(I've answered this question so many times that I've lost the count, and impossible to find a complete answer in the lot... I'll bookmark this answer this time...) Everything starts with Vim quickfix ...
Luc Hermitte's user avatar
  • 17.7k
9 votes
Accepted

Quickfix support for Python tracebacks

Vim comes with a set of "compiler" scripts, one of which is called "pyunit". If you run :compiler pyunit and then :make (with your suggested value for 'makeprg'), quickfix is ...
jamessan's user avatar
  • 11.2k
9 votes

autocmd with quickfix window

Just a remark to Martin Tournoij answer. When you just opened a quickfix buffer/window (and not switched to it yet), the &buftype option is not set yet. You may find another autocommand event ...
Kirill Bugaev's user avatar
8 votes

Which buffer quickfix file is opened in?

This is a fairly widespread and well-known annoyance. There are at least two plugins which aim to address it: vim-qf and QFEnter But, the behavior is quite predictable (cf :help quickfix.txt). If ...
Mass's user avatar
  • 14.2k
8 votes
Accepted

Using global command on Quickfix entries

Update: New official vim plugin cfilter Since 21.8.2018 (patch: 8.1.0311) the plugin cfilter is distributed with vim in $VIMRUNTIME. It is documented under :h cfilter-plugin. Load plugin cfilter ...
Hotschke's user avatar
  • 4,830
8 votes
Accepted

Skip the quickfix list when buffer switching using :bn

You can adapt either of the answers here to skip the quickfix: Here's my one: function! BSkipQuickFix(command) let start_buffer = bufnr('%') execute a:command while &buftype ==# 'quickfix' ...
Rich's user avatar
  • 32.4k
8 votes
Accepted

Import an error file to the quickfix list without leaving vim

Try :h :cfile or :h :cgetfile :cf[ile][!] [errorfile] Read the error file and jump to the first error. This is done automatically when Vim is started with the -q option. You ...
Maxim Kim's user avatar
  • 13.8k
8 votes
Accepted

How to navigate vim buffers using quickfix list?

VimScript makes a difference between commands and expressions. Whatever you type in the command-line is a command. Commands can output some text, but they cannot "return" anything, and so ...
Matt's user avatar
  • 21.3k
7 votes

How to auto fix common linting errors reported via syntastic?

The solution given in Jepz's answer didn't completely work for me. eslint was correctly called with the --fix option. However, maybe it's because of internals that have changed, but it seems like ...
Jerska's user avatar
  • 171
7 votes
Accepted

How to load list of files in commit into quickfix

You could use the following function which has the advantage of not changing the state of your local git repo: function! CommitQF(...) " Get the commit hash if it was specified let commit = a:...
statox's user avatar
  • 50.4k
7 votes
Accepted

how to check whether the location list for the current window is open

how to check whether the location list for the current window is open You could try to inspect the 'winid' property of the location list. If the location window is open, the value of the property ...
user938271's user avatar
  • 5,997
7 votes

How to save quickfix list per Neovim session using :mksession?

Quickfix lists (shortened to "qflist" from here on) are not saved with :mksession. Probably because the list is saved in a temporary file which is scrubbed when exiting the current vim ...
3N4N's user avatar
  • 5,864
6 votes

How to load list of files in commit into quickfix

Plugin Fugitive v3.2 (Jan 2020) vim-fugitive has added new commands since the OP raised this question which can do exactly what the OP has asked. Now you can call :Git difftool or the abbreviated ...
Hotschke's user avatar
  • 4,830
6 votes
Accepted

Go to quickfix next/previous (cnext/cprevious) relative to current file position?

There is no built in way to do file specific :cnext. You would have to roll your own function/command to do such a task. Here is my interpretation of :Cfnext: command! -bar -count=1 Cfnext exe 'cc'.(...
Peter Rincker's user avatar
5 votes

How to change the cursor line higlighting only for one window (namely the quickfix one)?

Patch 8.0.0641 introduced a separate highlight group for the quickfix line, called QuickFixLine. With patch 8.0.0653 this group is linked to the Search highlight by default, because for some color ...
Jürgen Krämer's user avatar
5 votes
Accepted

Calling vimgrep so that results from the current file are on top?

You can sort the resulting quickfix list to give priority to current buffer, then run uniq() on it. Sadly you need to handle sorting quickfix items almost completely. For example the following will ...
Sato Katsura's user avatar
  • 4,019
5 votes

How to load list of files in commit into quickfix

Here are two related approaches. Both use git-* scripts; if you put them on your PATH, you can invoke them as if they were subcommands of git. Use the contrib script git-jump The git-jump script ...
D. Ben Knoble's user avatar
  • 27.3k
5 votes
Accepted

Is it possible to align the results in the quickfix list in columns

Some more searching yielded the qf-layout plugin, which is working great in my initial tests! In order to show only the basename instead of the entire filepath, I modified line 84 from let l....
joelostblom's user avatar
5 votes

Is it possible to align the results in the quickfix list in columns

If your Vim includes the patch 8.2.0959, you can set the 'quickfixtextfunc' option to the name of a Vimscript function whose task is to format each entry displayed in the quickfix window. To get the ...
user938271's user avatar
  • 5,997
5 votes

How to conceal filename and line number in quickfix window?

While the other answers here have all the necessary pointers ever needed, I think there is lacking a comprehensive solution IMHO. Below is a ready-to-paste in your .vimrc (or equivalent) au ...
Loves Probability's user avatar
5 votes

Changing how the quickfix list displays matches

What I'd like to do is "add a column" to the quickfix list that displays that "type" (so, for @CHECK it would be CHECK, and so on) An input file and the desired quickfix window ...
user938271's user avatar
  • 5,997
5 votes
Accepted

How to get rid of inline linting errors?

Found it. Turns out it was not Ale doing it, but rather LanguageClient-neovim. The setting to turn it off is let g:LanguageClient_useVirtualText = 0
Mad Wombat's user avatar
5 votes

load quickfixlist into a specific window

I don’t know of a built in way to do that, but here’s a function that will do it for you: function! OpenQuickfixHere() abort copen let bufn = bufnr('%') let winn = winnr() wincmd p execute '...
Rich's user avatar
  • 32.4k

Only top scored, non community-wiki answers of a minimum length are eligible