Better detection of shortmess 'c' availability

Also noting that the annoying messages during completion go away with Vim
7.3.314.

Related to #642.
This commit is contained in:
Strahinja Val Markovic 2014-05-28 15:48:49 -07:00
parent 8615e408b4
commit 666cf3859a
3 changed files with 17 additions and 16 deletions

View File

@ -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 <bla bla> 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

View File

@ -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

View File

@ -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 ):