diff --git a/python/completers/all/identifier_completer.py b/python/completers/all/identifier_completer.py index cd181fda..8aa013a2 100644 --- a/python/completers/all/identifier_completer.py +++ b/python/completers/all/identifier_completer.py @@ -87,8 +87,8 @@ class IdentifierCompleter( Completer ): def AddBufferIdentifiers( self ): filetype = vim.eval( "&filetype" ) filepath = vim.eval( "expand('%:p')" ) - collect_from_comments_and_strings = bool( int( vimsupport.GetVariableValue( - "g:ycm_collect_identifiers_from_comments_and_strings" ) ) ) + collect_from_comments_and_strings = vimsupport.GetBoolValue( + "g:ycm_collect_identifiers_from_comments_and_strings" ) if not filetype or not filepath: return diff --git a/python/vimsupport.py b/python/vimsupport.py index 5399d0eb..6760755f 100644 --- a/python/vimsupport.py +++ b/python/vimsupport.py @@ -44,7 +44,7 @@ def CurrentColumn(): def GetUnsavedBuffers(): def BufferModified( buffer_number ): to_eval = 'getbufvar({0}, "&mod")'.format( buffer_number ) - return bool( int( vim.eval( to_eval ) ) ) + return GetBoolValue( to_eval ) return ( x for x in vim.buffers if BufferModified( x.number ) ) @@ -78,3 +78,7 @@ def CurrentFiletypes(): def GetVariableValue( variable ): return vim.eval( variable ) + + +def GetBoolValue( variable ): + return bool( int( vim.eval( variable ) ) )