Add GetBoolValue helper in vimsupport
This commit is contained in:
parent
98ff82ece5
commit
70a2a722fe
@ -87,8 +87,8 @@ class IdentifierCompleter( Completer ):
|
|||||||
def AddBufferIdentifiers( self ):
|
def AddBufferIdentifiers( self ):
|
||||||
filetype = vim.eval( "&filetype" )
|
filetype = vim.eval( "&filetype" )
|
||||||
filepath = vim.eval( "expand('%:p')" )
|
filepath = vim.eval( "expand('%:p')" )
|
||||||
collect_from_comments_and_strings = bool( int( vimsupport.GetVariableValue(
|
collect_from_comments_and_strings = vimsupport.GetBoolValue(
|
||||||
"g:ycm_collect_identifiers_from_comments_and_strings" ) ) )
|
"g:ycm_collect_identifiers_from_comments_and_strings" )
|
||||||
|
|
||||||
if not filetype or not filepath:
|
if not filetype or not filepath:
|
||||||
return
|
return
|
||||||
|
@ -44,7 +44,7 @@ def CurrentColumn():
|
|||||||
def GetUnsavedBuffers():
|
def GetUnsavedBuffers():
|
||||||
def BufferModified( buffer_number ):
|
def BufferModified( buffer_number ):
|
||||||
to_eval = 'getbufvar({0}, "&mod")'.format( 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 ) )
|
return ( x for x in vim.buffers if BufferModified( x.number ) )
|
||||||
|
|
||||||
@ -78,3 +78,7 @@ def CurrentFiletypes():
|
|||||||
|
|
||||||
def GetVariableValue( variable ):
|
def GetVariableValue( variable ):
|
||||||
return vim.eval( variable )
|
return vim.eval( variable )
|
||||||
|
|
||||||
|
|
||||||
|
def GetBoolValue( variable ):
|
||||||
|
return bool( int( vim.eval( variable ) ) )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user