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

GoToDefinition in a new tab #1146

Closed j5shi closed 10 years ago

j5shi commented 10 years ago

Could you please add (or is there) an option to go to definition in a new tab? I found nnoremap <leader>f :YcmCompleter GoToDefinition<CR> will open the buffer in the current tab view.

vheon commented 10 years ago

:h g:ycm_goto_buffer_command

j5shi commented 10 years ago

I couldn't find g:ycm_goto_buffer_command on help doc youcompleteme.txt, strange...I'm using YCM on windows.

j5shi commented 10 years ago

though I added let g:ycm_goto_buffer_command = 'new-tab' to my _vimrc, nothing changed, and I'm using YCM on windows, I'm afriad my YCM is way behind the latest version.

vheon commented 10 years ago

I'm not sure if you have to restart vim. And this feature has been there since March 4th.

EDIT: I'm trying but it seems to be broken. Reopening.

vheon commented 10 years ago

I'm investigating further and it seems that the g:ycm_goto_buffer_command options is used only when we have to move in a different file. Which is reasonable but I don't know if it is the intended behaviour, so we have to wait for @Valloric.

Valloric commented 10 years ago

I'm investigating further and it seems that the g:ycm_goto_buffer_command options is used only when we have to move in a different file. Which is reasonable but I don't know if is the intended behaviour

This is the intended behavior. It's what most people want and adding a conf option to change this isn't worth it.

pbn4 commented 8 years ago

I know it's a bit old, but the solution is to map multiple commands to one key i.e.: nnoremap f :tab split | YcmCompleter GoToDefinition

jnm commented 6 years ago

Now it's even older :smirk: but, in case it's helpful, I found I had to escape the pipe:

nnoremap f :tab split \| YcmCompleter GoToDefinition
forwidur commented 5 years ago

We are almost there: nnoremap f :tab split \| YcmCompleter GoToDefinition<CR> ;-)

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