diff --git a/README.md b/README.md index b433da5f..aef747c7 100644 --- a/README.md +++ b/README.md @@ -2879,15 +2879,14 @@ let g:ycm_use_ultisnips_completer = 1 ### The `g:ycm_goto_buffer_command` option Defines where `GoTo*` commands result should be opened. Can take one of the -following values: -`[ 'same-buffer', 'split', 'split-or-existing-window' ]` -If this option is set to the `'same-buffer'` but current buffer can not -be switched (when buffer is modified and `nohidden` option is set), -then result will be opened in a split. When the option is set to +following values: `'same-buffer'`, `'split'`, or `'split-or-existing-window'`. +If this option is set to the `'same-buffer'` but current buffer can not be +switched (when buffer is modified and `nohidden` option is set), then result +will be opened in a split. When the option is set to `'split-or-existing-window'`, if the result is already open in a window of the -current tab page (or any tab pages with the `:tab` modifier; see below), it -will jump to that window. Otherwise, the result will be opened in a split as if -the option was set to `'split'`. +current tab page (or any tab pages with the `:tab` modifier; see below), it will +jump to that window. Otherwise, the result will be opened in a split as if the +option was set to `'split'`. To customize the way a new window is split, prefix the `GoTo*` command with one of the following modifiers: `:aboveleft`, `:belowright`, `:botright`, @@ -2903,6 +2902,10 @@ To open in a new tab page, use the `:tab` modifier with the `'split'` or :tab YcmCompleter GoTo ``` +**NOTE:** command modifiers were added in Vim 7.4.1898. If you are using an +older version, you can still configure this by setting the option to one of the +deprecated values: `'vertical-split'`, `'new-tab'`, or `'new-or-existing-tab'`. + Default: `'same-buffer'` ```viml diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index f618db16..f8eadb36 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -844,12 +844,21 @@ function! s:SetUpCommands() command! YcmDebugInfo call s:DebugInfo() command! -nargs=* -complete=custom,youcompleteme#LogsComplete \ YcmToggleLogs call s:ToggleLogs() - command! -nargs=* -complete=custom,youcompleteme#SubCommandsComplete -range - \ YcmCompleter call s:CompleterCommand(, - \ , - \ , - \ , - \ ) + if s:Pyeval( 'vimsupport.VimVersionAtLeast( "7.4.1898" )' ) + command! -nargs=* -complete=custom,youcompleteme#SubCommandsComplete -range + \ YcmCompleter call s:CompleterCommand(, + \ , + \ , + \ , + \ ) + else + command! -nargs=* -complete=custom,youcompleteme#SubCommandsComplete -range + \ YcmCompleter call s:CompleterCommand('', + \ , + \ , + \ , + \ ) + endif command! YcmDiags call s:ShowDiagnostics() command! YcmShowDetailedDiagnostic call s:ShowDetailedDiagnostic() command! YcmForceCompileAndDiagnostics call s:ForceCompileAndDiagnostics() diff --git a/doc/youcompleteme.txt b/doc/youcompleteme.txt index 250ac99b..987e49a3 100644 --- a/doc/youcompleteme.txt +++ b/doc/youcompleteme.txt @@ -3098,8 +3098,8 @@ Default: '1' The *g:ycm_goto_buffer_command* option Defines where 'GoTo*' commands result should be opened. Can take one of the -following values: "[ 'same-buffer', 'split', 'split-or-existing-window' ]" If -this option is set to the "'same-buffer'" but current buffer can not be +following values: "'same-buffer'", "'split'", or "'split-or-existing-window'". +If this option is set to the "'same-buffer'" but current buffer can not be switched (when buffer is modified and 'nohidden' option is set), then result will be opened in a split. When the option is set to "'split-or-existing- window'", if the result is already open in a window of the current tab page (or @@ -3119,6 +3119,10 @@ To open in a new tab page, use the ':tab' modifier with the "'split'" or > :tab YcmCompleter GoTo < +**NOTE:** command modifiers were added in Vim 7.4.1898. If you are using an +older version, you can still configure this by setting the option to one of the +deprecated values: "'vertical-split'", "'new-tab'", or "'new-or-existing-tab'". + Default: "'same-buffer'" > let g:ycm_goto_buffer_command = 'same-buffer' diff --git a/python/ycm/tests/test_utils.py b/python/ycm/tests/test_utils.py index 2a6dd624..794724e9 100644 --- a/python/ycm/tests/test_utils.py +++ b/python/ycm/tests/test_utils.py @@ -22,7 +22,7 @@ from __future__ import absolute_import # Not installing aliases from python-future; it's unreliable and slow. from builtins import * # noqa -from collections import defaultdict +from collections import defaultdict, namedtuple from future.utils import iteritems, PY2 from mock import DEFAULT, MagicMock, patch from hamcrest import assert_that, equal_to @@ -60,6 +60,7 @@ REDIR_START_REGEX = re.compile( '^redir => (?P[\w:]+)$' ) REDIR_END_REGEX = re.compile( '^redir END$' ) EXISTS_REGEX = re.compile( '^exists\( \'(?P