Youcompleteme: GoToDefinition in a new tab

Created on 3 Sep 2014  路  10Comments  路  Source: ycm-core/YouCompleteMe

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.

Most helpful comment

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

All 10 comments

:h g:ycm_goto_buffer_command

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

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.

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.

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.

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.

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

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwu26 picture jwu26  路  3Comments

Jzarecta picture Jzarecta  路  4Comments

tgzhou98 picture tgzhou98  路  3Comments

d0u9 picture d0u9  路  4Comments

vbextreme picture vbextreme  路  4Comments