ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.44k stars 2.81k forks source link

Add option to choose tab or buffer for GoTo* #319

Closed AntoineD closed 10 years ago

AntoineD commented 11 years ago

jedi-vim allows to choose whether a buffer opens in a tab or a window after a GoTo command, would it be possible to have this feature?

JazzCore commented 11 years ago

I thought about that when i was writing GoTo* for python. This should be quite easy to add if @Valloric is okay with it

Valloric commented 11 years ago

Is this use case not already handled with the switchbuf Vim option (see :h switchbuf for details)? That option determines how Vim opens files. I think it should work for the GoTo* commands as well.

JazzCore commented 11 years ago

It seems that switchbuf is correctly respected only when jumping from quickfix list. It does not work when switching buffers with :edit so it's not supported at the moment

Valloric commented 11 years ago

Then we need to support this use case in some way.

diefans commented 11 years ago

+1

davits commented 10 years ago

+1 Also there is a vim exception traceback in plugin if GoTo* command is ran from an unsaved file. So GoTo* should always open in new tab or split for unsaved buffer, even if user prefers same buffer. One of the ways to cover this: by adding 2 options: g:ycm_goto_try_same_buffer {0, 1} g:ycm_goto_buffer_command {split, hsplit, tabe}

Valloric commented 10 years ago

This has actually been implemented for months now; I don't know why the issue wasn't closed. Anyway, docs for the feature are here: https://github.com/Valloric/YouCompleteMe#the-gycm_goto_buffer_command-option

AntoineD commented 10 years ago

I did not notice it, thanks @davits and @Valloric.

Kipparis commented 5 years ago

Reason may be not in ycm, but in other plugins: I noticed that jedi-vim takes control over go-to command and after specifying let g:jedi#use_tabs_not_buffers = 1 all work as expected