How to make Vim quickfix list launch files in a new tab?

autocmd FileType qf nnoremap <buffer> <Enter> <C-W><Enter><C-W>T

also works if you use:

tab copen

which would otherwise first split the window, even with set switchbuf+=newtab.

See also: https://vi.stackexchange.com/questions/6996/how-to-make-enter-open-new-tabs-for-the-quickfix-window-when-it-is-opened-with


Quickfix-window commands respect the switchbuf option when creating the buffer. The switchbuf option has the newtab specifier that instructs Vim to open a new tab page before loading the buffer to switch to. If one adds this key to the option via

:set switchbuf+=newtab

the entries in the quickfix window will be opened in separate tab pages.

There is the usetab specifier that also might be useful in this case. It prescribes Vim to switch to an existing tab page if it contains a window displaying the target buffer, instead of duplicating it in a new tab.

:set switchbuf+=usetab,newtab

The value of switchbuf also (partially) affects other buffer-switching commands, such as :bfirst, :blast, :sbuffer, :sbnext, and :sbprevious.


How about trying QFEnter plugin?
You can open each item in a new tab or a new vertical/horizontal split window without changing switchbuf option.
It also allows you to open multiple quickfix items at once with a visual selection block.

Tags:

Vim

Tabs