Vim: Skip quickfix buffer when cycling through windows

vim

A common pattern when I edit files in vim is to have two buffers open using :sb, and cycle between them using C-w C-w. I tend to avoid having more two windows open because then the cognitive (and number of keystrokes) overhead of switching becomes higher.

I recently started using the quickfix functionality provided by :make, and now I have a dilemma. You see, the quickfix window constitutes another window: so now if I am mashing C-w C-w I have to cycle through three buffers, one of which I don't actually want to cycle into (usually). So, is there a way to make the buffer cycling commands skip qf windows?

General suggestions on how to improve my vim workflow here would also be appreciated.

Best Answer

You need to override the command with a custom mapping in which you check for the quickfix window, and then just jump again:

:nnoremap <silent> <C-w><C-w> <C-w><C-w>:if &buftype ==# 'quickfix'<Bar>wincmd w<Bar>endif<CR>
Related Question