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,770
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
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 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
  • 32k
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.4k
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.1k
9 votes
Accepted

How to make <enter> open new tabs for the quickfix window when it is opened with "tab copen" including the first time?

This workaround seems to work (mind the capitalized T in the end): autocmd FileType qf nnoremap <buffer> <Enter> <C-W><Enter><C-W>T It will create a mapping that is ...
Ingo's user avatar
  • 986
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.1k
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,750
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
  • 32k
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.4k
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
  • 20.7k
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

How to make <enter> open new tabs for the quickfix window when it is opened with "tab copen" including the first time?

This mapping does what I think you want, put it in ~/.vim/after/ftplugin/qf.vim. nnoremap <buffer> <CR> :tabnew\|cc <C-r>=line(".")<CR><CR>
romainl's user avatar
  • 40.7k
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
  • 49.9k
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,957
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,724
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,750
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,009
5 votes

How to make <enter> open new tabs for the quickfix window when it is opened with "tab copen" including the first time?

The quickfix/location list is an interesting beast. I'd recommend reading into :help quickfix for some inner workings of these two features (pretty much interchangeable; list commands are prefixed ...
Dan Bradbury's user avatar
  • 1,216
5 votes
Accepted

How do I make list of search results editable?

You definitively should try the plugin QFGrep plugin, which was created after the similar question mentioned in the comments: Is it possible to grep Vimʼs quickfix?. I've been using it for a year and ...
mMontu's user avatar
  • 6,640
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
  • 26.2k
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,957
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,957
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
  • 32k

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