diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 18856e25..e6a78aad 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -68,11 +68,9 @@ function! youcompleteme#Enable() py import ycm py ycm_state = ycm.YouCompleteMe() - if g:ycm_filetype_completion_enabled - " trigger omni completion, deselects the first completion - " candidate that vim selects by default - inoremap - endif + " trigger omni completion, deselects the first completion + " candidate that vim selects by default + inoremap " TODO: make this a nicer, customizable map nnoremap d :call ShowDetailedDiagnostic() @@ -87,7 +85,7 @@ endfunction function! s:AllowedToCompleteInCurrentFile() " If the user set the current filetype as a filetype that YCM should ignore, " then we don't do anything - return !get( g:ycm_filetypes_to_ignore, &filetype, 0 ) + return !get( g:ycm_filetypes_to_completely_ignore, &filetype, 0 ) endfunction diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index e4e1ca16..7192dbc8 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -34,12 +34,11 @@ let g:loaded_youcompleteme = 1 let g:ycm_min_num_of_chars_for_completion = \ get( g:, 'ycm_min_num_of_chars_for_completion', 2 ) -let g:ycm_filetypes_to_ignore = - \ get( g:, 'ycm_filetypes_to_ignore', { 'notes' : 1 } ) +let g:ycm_filetypes_to_completely_ignore = + \ get( g:, 'ycm_filetypes_to_completely_ignore', { 'notes' : 1 } ) -" TODO: make this more granular -let g:ycm_filetype_completion_enabled = - \ get( g:, 'ycm_filetype_completion_enabled', 1 ) +let g:ycm_filetype_specific_completion_to_disable = + \ get( g:, 'ycm_filetype_specific_completion_to_disable', {} ) let g:ycm_allow_changing_updatetime = \ get( g:, 'ycm_allow_changing_updatetime', 1 ) diff --git a/python/ycm.py b/python/ycm.py index 914639c0..065dd4b2 100644 --- a/python/ycm.py +++ b/python/ycm.py @@ -25,6 +25,9 @@ import os import sys from completers.all.identifier_completer import IdentifierCompleter +FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE = vim.eval( + 'g:ycm_filetype_specific_completion_to_disable' ) + class YouCompleteMe( object ): def __init__( self ): @@ -76,7 +79,8 @@ class YouCompleteMe( object ): def FiletypeCompletionEnabledForCurrentFile( self ): - return ( bool( int( vim.eval( 'g:ycm_filetype_completion_enabled' ) ) ) and + return ( vimsupport.CurrentFiletype() not in + FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE and self.FiletypeCompletionAvailableForFile() )