Quickfix Intro

Quickfix lists were very mysterious to me when I started with vim. I knew that there was a list of items and that it would pop up and if I left them I didn't know how to go back. Little did I know how useful they are, especially when navigating histories, such as git.

Lets create a quick quickfix

open up vim in the root of vim-nav-playground

vim .

now execute

:grep SOCKET_OPEN **/*.(c\|h)

You should see something like this:

QuickFix Result

Once you press <CR> you will see that the results disappear and you are navigated to the first result. What should you do? The proper answer is consult the :h quickfix page, but since I am here, let me walk you through some actions.

When dealing with a quickfix you need 3 commands primarily, :copen, :cnext, and :cprev. Lets try :copen first. Once you have executed it you should see the following.

QuickFix Open

Lets select the other option. This will cause the above buffer to navigate and the quickfix list will remain open. Oh no, how do we get back to the quickfix list?

you could navigate back by executing a copen

:copen

you could force navigate back by closing the current window. There is nothing left but going back to the remaining buffer that is open.

:q

You can window navigate. You can start a window navigation by pressing <C-w>. What do you think you should press next to navigate towards the quickfix menu?

If you said j you are awesome. YES! Use your vim movements you already know! Don't you love when things come full circle!

Anywho, so you can guess you can move betwixt splits by press <C-w> and h, j, k, or l. This is great, but it kind of sucks.

WHAT DO WE DO NOW???

If I have to say make a remap one more time.

" I don't know if I love these remaps yet.  I am considering doing
" <leader>c(k|j|o)
nnoremap <C-k> :cnext<CR>
nnoremap <C-j> :cprev<CR>
nnoremap <C-E> :copen<CR>