18

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 describing each error (filename, line number, position, etc.). In this case we're specifying a minimal set of information: the buffer number map() takes a List ...


14

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 | catch | endtry command! Lprev try | lprev | catch | llast | catch | endtry If the exception is caught, it jumps to the first/last item. You can use cabbrev so ...


11

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 option to the eslint execution with syntactic is straight forward. Simply add this to your .vimrc: " execute eslint with --fix flag let g:...


10

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 the quickfix window, and then performs either a <CR> or za accordingly. See: :h :map-expr :h 'buftype' :h expr1 :h string Mapping to a function You can ...


10

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/after/ftplugin/qf.vim, and put this line in it: setlocal wrap The first method adds yet another autocommand to the possibly large pile of autocommands already ...


9

You should try this mapping: nnoremap gb :ls<CR>:b<Space> At the prompt, type the desired buffer number and hit Enter.


8

Prefixing your command with :vert modifies it to use a vertical split: :vert copen


7

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 populated as you expect. However, it only works well if there's one level to the stack trace. Improving that compiler script would be a useful exercise. The unstack plugin may be of ...


7

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 checktime was called before the end of eslint --fix, so the file reloading didn't work properly, triggering a file has changed, are you sure you want to write to it?...


7

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 when needed or load it always in your vimrc :packadd cfilter Using abbreviations in case of a vanilla vim this can be as short as :pa c<tab><cr>. ...


6

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. This is often a full path name. Vim simplifies or resolves those names to relative path names upon certain events. The problem is that those names are not ...


6

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 completely independent from the jumplist. When using the quickfix window, you are supposed to press <CR> to jump to the location of the current entry while ...


6

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 local to the quickfix buffer (it also works in location lists, since they have the same filetype, i.e. qf). This mapping will first open the item under the cursor ...


6

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:0 == 0 ? '' : a:1 " Get the result of git show in a list let flist = system('git show --name-only ' . commit . ' | tail -n +7') let flist = split(...


5

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>


5

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 with l and quickfix with q) It sounds like the default quickfix opens won't solve your problem (opening in a new tab is not supported by default) I'd check out ...


5

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 a half, and it works very well. It allows to grep (and reverse grep) the quickfix results, and also allows to restore the original contents. Check plugin ...


5

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, you can add highlighting patterns to it. For example to highlight Ok: and Err: you could create a file ~/.vim/after/syntax/qf.vim, with contents something ...


5

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 schemes the colors chosen for patch 8.0.0641 did not work well. So if you have a current version of Vim you can use hi QuickFixLine cterm=None ctermbg=256 guibg=#...


5

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 the file is already open, vim switches to it and moves to the correct line/column. Otherwise, the window directly above the quickfix window is used (and the ...


5

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 variable though: autocmd WinEnter * if &buftype == 'quickfix' | echo 'winenter' | endif


4

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 it collapses the stack trace to a single error message. For example the following python script: def lumberjack(): bright_side_of_death() def ...


4

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 sort the results by buffer, then by line, then column, then text. If you need more precise sorting you can add more fields (see :h getqflist() to see what's ...


4

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 should be different than zero: if get(getloclist(0, {'winid':0}), 'winid', 0) " the location window is open ... else " the location window is closed ...


4

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' && bufnr('%') != start_buffer execute a:command endwhile endfunction nnoremap <Tab> :call BSkipQuickFix("bn")<CR> nnoremap <S-Tab&...


4

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 looking at originally and the buffers you navigated to via the quickfix, so to go back you are going to have to use Vim's regular buffer switching commands. If ...


3

I'm not familiar with CakePHP, but you could use :make for it: set makeprg=/vagrant/my_project/app/Console/cake\ test\ app\ Console/Command/FeedParseShell Then, if you run :make, the output of this command will be used to populate the quickfix list (which can be useful if the output identifies offending line numbers).


3

Color is represented using ansi escape sequences. On my computer ^[[0m^[[01;34mWord^[[0m represents a blue word. (^[ is the escape character`) Obviously this isn't useful to have in the output if you are writing to a file. So most program recognize that they are not writing to a tty and suppress the color output. If the program you are running supports it ...


3

Make and Ninja offer a -C flag. From Ninja: -C DIR change to DIR before doing anything else If I run Ninja in a shell with the -C flag pointing somewhere that isn't the working directory, then the reported paths are the same as if I had cd'd over to the build directory. Nonetheless, Vim knows to become more intelligent when you use this flag in your ...


3

quickfix.py parses the traceback into a vim-friendly errorformat. Here is an example of running it on a file with a single line 1 / 0. ❯❯❯ quickfix.py tests/errors/div_by_zero.py "tests/errors/div_by_zero.py":1: ZeroDivisionError: division by zero By default, it shows user files, but it can show system files too (running it on a file containing import os; ...


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