diff --git a/README.md b/README.md index 43d74f48..d4dbcbed 100644 --- a/README.md +++ b/README.md @@ -1654,13 +1654,7 @@ landed in Vim 7.3.584 (and a few commits before that). ### I get annoying messages in Vim's status area when I type If you're referring to the `User defined completion back at original` -and similar, then sadly there's no fix for those. Vim will emit them no matter -how hard I try to silence them. - -You'll have to learn to ignore them. It's a shitty "solution", I know. - -There's an [outstanding patch for Vim that fixes this issue][status-mes], but at -the time of writing Vim upstream hasn't yet merged it in. +and similar, then just update to Vim 7.4.314 and they'll go away. ### Nasty bugs happen if I have the `vim-autoclose` plugin installed diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index b20c9e9c..bb6ffb06 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -109,6 +109,7 @@ function! s:SetUpPython() py base.LoadJsonDefaultsIntoVim() py from ycmd import user_options_store py user_options_store.SetAll( base.BuildServerConf() ) + py from ycm import vimsupport if !pyeval( 'base.CompatibleWithYcmCore()') echohl WarningMsg | @@ -283,16 +284,10 @@ function! s:SetUpCpoptions() set cpoptions+=B " This prevents the display of "Pattern not found" & similar messages during - " completion. - " Patch: https://groups.google.com/forum/#!topic/vim_dev/WeBBjkXE8H8 - " At the time of writing, the patch hasn't been merged into Vim upstream, but - " will at some point. - " TODO: Check the Vim version (when patch lands) instead of doing try-catch - " here. - try + " completion. This is only available since Vim 7.4.314 + if pyeval( 'vimsupport.VimVersionAtLeast("7.4.314")' ) set shortmess+=c - catch - endtry + endif endfunction diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 501b4fda..9048812d 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -55,6 +55,18 @@ def TextAfterCursor(): return vim.current.line[ CurrentColumn(): ] +# Expects version_string in 'MAJOR.MINOR.PATCH' format, e.g. '7.4.301' +def VimVersionAtLeast( version_string ): + major, minor, patch = [ int( x ) for x in version_string.split( '.' ) ] + + # For Vim 7.4.301, v:version is '704' + actual_major_and_minor = GetIntValue( 'v:version' ) + if actual_major_and_minor != major * 100 + minor: + return False + + return GetBoolValue( 'has("patch{0}")'.format( patch ) ) + + # Note the difference between buffer OPTIONS and VARIABLES; the two are not # the same. def GetBufferOption( buffer_object, option ):