I want to work with quickfix without ever having a split window.

So I've set:

set switchbuf=newtab

as mentioned at https://stackoverflow.com/questions/6852763/vim-quickfix-list-launch-files-in-new-tab


tab copen

opens the quickfix window on a new tab.

But if I hit enter on a quickfix item, instead of creating a new tab, it first opens the location on a split in the current tab.

Only after this first split do new tabs get opened.

Is it possible to get new tabs from the first <enter>, and never see any splits?

Tested on Vim 7.4.


3 Answers 3


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 in a new window using <C-W><Enter> and then move it to an new tab using <C-W>T.


:help :autocmd
:help quickfix
:help CTRL-W_<Enter>
:help CTRL-W_T

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>
  • How does this compare to ingo's answer: vi.stackexchange.com/a/6999/2038 At first sight, that is more readable (I understand the ftplugin vs autocmd part :-)) Mar 23, 2016 at 21:38
  • 2
    You mentioned in your question that you don't want splits. Ingo's mapping opens the file in a new window and moves that window to a tab while my mapping doesn't create an intermediary window. Other than that, I'd say both get the job done. The choice is yours.
    – romainl
    Mar 23, 2016 at 22:42

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 QFEnter. It was built to give extra control over the quickfix menu and it looks like it should work out of the box for you.

Normal mode : Open an item under cursor in a new tab.

Visual mode : Open items in visual block in a sequence of new tabs.
Quickfix window is automatically opened in the new tab to help you open other Quickfix items.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.