Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM open compile error in existing or new tab

Tags:

c++

c

vim

makefile

When I compile or run a file from VIM all error references are opened in the last active buffer regardless if the file is open already in another vim tab. This behavior is very annoying.

Is there any way to force vim to behave like ':tab drop' on compile errors? (See http://vim.wikia.com/wiki/Edit_a_file_or_jump_to_it_if_already_open)

Thanks a lot for any hints!

like image 893
Peter Avatar asked Aug 21 '10 11:08

Peter


1 Answers

You're looking for the 'switchbuf' option. If you set switchbuf=useopen,usetab,newtab, then any window/tab that is already displaying the buffer with the error will be focused. If there isn't a window/tab displaying the buffer, then a new tab will be created in which to display it.

like image 137
jamessan Avatar answered Oct 12 '22 00:10

jamessan