Hello,
I have already seached the defects and read through youcompleteme.txt
I'm wondering whether it is possible to use
YouCompleter GoTo
to either split or not split when going to the definition.
I want to achieve a keymap like:
nmap <C-@><C-@> :YcmCompleter GoTo<CR>
nmap <C-@><Right> :rightbelow vertical YcmCompleter GoTo<CR>
where the first keymap (CTRL-SPACE + CTRL-SPACE) jumps in the current buffer without split to the definition
where the second keymap (CTRL-SPACE + right arrow) makes a vertical split to the right and jumps to the definition
This keymap currently behaves in this way (if g:ycm_goto_buffer_command = 'split-or-existing-window'):
If I set g:ycm_goto_buffer_command = 'same-buffer':
I'm not sure, whether this covers all use cases, but why don't you just delete the option g:ycm_goto_buffer_command and the user is then free to achieve all combinations of tab/split/nothing at all...:
:rightbelow vertical YcmCompleter GoTo
:tab YcmCompleter GoTo
YcmCompleter GoTo (no split/tab)
etc...
Yes, this is possible and is already implemented. You only need to have vim 7.4.1898 or newer.
For further information read :h g:ycm_goto_buffer_command.
Maybe you can point me out how to achieve the behaviour than...?
Of course I have read the information :h g:ycm_goto_buffer_command, but did not find out how to achieve the desired behaviour.
I have vim version 8.0:
pi@raspberrypi:~/NimbusUserland $ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 30 2017 18:21:38)
I was too quick to say that this can work easily. It can be made to work, but it's not pretty.
The mapping would need to set the g:ycm_goto_buffer_command variable, restart the ycmd server and then run YcmCompleter GoTo, which would be a problem because of the extra conf loading... So you would need a third mapping which would toggle the value of the variable and restart the server. Then you would be prompted to load the extra conf and finally you would hit your desired mapping to run GoTo command. Ugh... that's terrible.
I'm reopening this issue for further discussion.
Yes, we need to improve this. It's rather annoying to not be able to force a jump in the current window when the g:ycm_goto_buffer_command is set to split or split-or-existing-window. I like the idea of jumping in the current window if no modifier is given to the YcmCompleter GoTo command. If we implement this, we can deprecate the same-buffer value from the g:ycm_goto_buffer_command option. However, we can't completely remove the g:ycm_goto_buffer_command option because we need to stay compatible with older versions of Vim and also because of the difference in behavior between split and split-or-existing-window.
We could keep the option for now and remove it completely once we drop support for older vim versions. Our users are more likely to be familiar with :tab, :botright etc than with our custom configuration option.
Hi, I'm not sure if this is actually relevant, but I have been doing the following to decide whether to split or not and it works fine (VIM 8.1)
nnoremap \
nnoremap \
nnoremap \
\ You could obviously map :botright [vsplit | split] as well.
Most helpful comment
Hi, I'm not sure if this is actually relevant, but I have been doing the following to decide whether to split or not and it works fine (VIM 8.1)
nnoremap \
nnoremap \
nnoremap \
\
\
\
You could obviously map :botright [vsplit | split] as well.