Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim quickfix avoid buffer change

Tags:

vim

I'm using vimgrep with cw to open the search results in the quickfix buffer. Every time I select a line in the quickFix list the cursor shifts to the new file buffer. How do I avoid this and keep my cursor in the quickFix list always?

like image 839
Rnet Avatar asked Feb 17 '14 20:02

Rnet


1 Answers

Assuming you are using <CR> to "select a line in the quickFix list", you can simply remap <CR> in the quickfix window so that you come back to the previous window after jumping to the matching line.

Make sure you have filetype plugin indent on and add the line below to ~/.vim/ftplugin/qf.vim:

nnoremap <buffer> <CR> <CR><C-w>p
like image 141
romainl Avatar answered Nov 15 '22 04:11

romainl