Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
21 votes

How do I have buffers listed in a quickfix window in Vim?

You can populate the quickfix list with each buffer like this: :call setqflist(map(filter(range(1, bufnr('$')), 'buflisted(v:val)'), '{"bufnr": v:val}')) setqflist() takes a List of Dictionary items ...
user avatar
  • 7,140
19 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 | ...
user avatar
  • 6,320
15 votes
Accepted

How to map Enter to custom command EXCEPT in quick fix?

Using an expression mapping is the easiest way to do this: nnoremap <expr> <CR> &buftype ==# 'quickfix' ? "\<CR>" : 'za' This defines a mapping that checks whether you are in ...
user avatar
  • 27.4k
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 ...
user avatar
  • 231
12 votes
Accepted

How to automatically set wrapping for quickfix window?

Autocommands to the rescue! Put these lines in your vimrc: augroup quickfix autocmd! autocmd FileType qf setlocal wrap augroup END There's also this slightly cleaner method: create ~/.vim/...
user avatar
  • 32.6k
12 votes
Accepted

Open quickfix in vertical split

Prefixing your command with :vert modifies it to use a vertical split: :vert copen
user avatar
  • 8,739
11 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, ...
user avatar
  • 211
9 votes
Accepted

Showing colors in vim's quickfix window from Dispatch tasks

If you want your tests to embed colour codes (presumably ANSI) in their output and then have the colours show in the quickfix window, you're out of luck. However the quickfix buffer is just a buffer, ...
user avatar
  • 3,568
9 votes

How do I have buffers listed in a quickfix window in Vim?

You should try this mapping: nnoremap gb :ls<CR>:b<Space> At the prompt, type the desired buffer number and hit Enter.
user avatar
  • 32.6k
9 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 ...
user avatar
9 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 ...
user avatar
  • 27.4k
8 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 ...
user avatar
  • 10.3k
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 ...
user avatar
  • 3,970
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 ...
user avatar
  • 9,783
7 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 ...
user avatar
  • 846
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 ...
user avatar
  • 171
7 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 ...
user avatar
  • 12.6k
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:...
user avatar
  • 45.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 ...
user avatar
  • 5,457
7 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' ...
user avatar
  • 27.4k
7 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 ...
user avatar
  • 15.5k
7 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 ...
user avatar
6 votes
Accepted

uneven quickfix window output from Ack/Ag

Yes, it is annoying. When Vim creates a quickfix list from the output of a program such as Ack, it creates a buffer for each file in the quickfix list using the name provided by the other program. ...
user avatar
  • 5,854
6 votes

Keeping quickfix jumps in the jump list

I don't think you took the time to read :help quickfix. Your :grep results populate the "quickfix list" which is then optionally displayed in the "quickfix window". The whole quickfix mechanism is ...
user avatar
  • 32.6k
6 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>
user avatar
  • 32.6k
6 votes

autocmd with quickfix window

Just remark to Martin Tournoij answer. When you just open quickfix buffer/window (not switch from another buffer/window) &buftype variable isn't setted yet, so may be useful one more autocmd ...
user avatar
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 ...
user avatar
  • 1,096
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 ...
user avatar
  • 6,370
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 ...
user avatar
  • 3,849
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 ...
user avatar

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