diff options
Diffstat (limited to 'autoload/deoplete')
-rw-r--r-- | autoload/deoplete/custom.vim | 14 | ||||
-rw-r--r-- | autoload/deoplete/handler.vim | 42 | ||||
-rw-r--r-- | autoload/deoplete/init.vim | 42 | ||||
-rw-r--r-- | autoload/deoplete/mapping.vim | 18 | ||||
-rw-r--r-- | autoload/deoplete/mappings.vim | 26 | ||||
-rw-r--r-- | autoload/deoplete/util.vim | 86 |
6 files changed, 108 insertions, 120 deletions
diff --git a/autoload/deoplete/custom.vim b/autoload/deoplete/custom.vim index c116f4d..7f121f5 100644 --- a/autoload/deoplete/custom.vim +++ b/autoload/deoplete/custom.vim @@ -4,16 +4,16 @@ " License: MIT license "============================================================================= -function! deoplete#custom#get() abort "{{{ +function! deoplete#custom#get() abort if !exists('s:custom') let s:custom = {} let s:custom._ = {} endif return s:custom -endfunction"}}} +endfunction -function! deoplete#custom#get_source_var(source_name) abort "{{{ +function! deoplete#custom#get_source_var(source_name) abort let custom = deoplete#custom#get() if !has_key(custom, a:source_name) @@ -21,13 +21,11 @@ function! deoplete#custom#get_source_var(source_name) abort "{{{ endif return custom[a:source_name] -endfunction"}}} +endfunction -function! deoplete#custom#set(source_name, option_name, value) abort "{{{ +function! deoplete#custom#set(source_name, option_name, value) abort for key in split(a:source_name, '\s*,\s*') let custom_source = deoplete#custom#get_source_var(key) let custom_source[a:option_name] = a:value endfor -endfunction"}}} - -" vim: foldmethod=marker +endfunction diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim index a73ef87..b7dff95 100644 --- a/autoload/deoplete/handler.vim +++ b/autoload/deoplete/handler.vim @@ -4,7 +4,7 @@ " License: MIT license "============================================================================= -function! deoplete#handler#_init() abort "{{{ +function! deoplete#handler#_init() abort augroup deoplete autocmd! autocmd InsertLeave * call s:on_insert_leave() @@ -20,9 +20,9 @@ function! deoplete#handler#_init() abort "{{{ endfor call s:on_event('Init') -endfunction"}}} +endfunction -function! s:completion_check(event) abort "{{{ +function! s:completion_check(event) abort let delay = get(g:deoplete#_context, 'refresh', 0) ? \ g:deoplete#auto_refresh_delay : g:deoplete#auto_complete_delay if has('timers') && delay > 0 @@ -38,17 +38,17 @@ function! s:completion_check(event) abort "{{{ endif return s:completion_begin(a:event) -endfunction"}}} +endfunction -function! s:completion_delayed(timer) abort "{{{ +function! s:completion_delayed(timer) abort let timer = s:timer unlet! s:timer if b:changedtick == timer.changedtick call s:completion_begin(timer.event) endif -endfunction"}}} +endfunction -function! s:completion_begin(event) abort "{{{ +function! s:completion_begin(event) abort let context = deoplete#init#_context(a:event, []) if s:is_skip(a:event, context) return @@ -78,8 +78,8 @@ function! s:completion_begin(event) abort "{{{ call deoplete#mapping#_set_completeopt() call rpcnotify(g:deoplete#_channel_id, \ 'deoplete_auto_completion_begin', context) -endfunction"}}} -function! s:is_skip(event, context) abort "{{{ +endfunction +function! s:is_skip(event, context) abort if s:is_skip_text(a:event) return 1 endif @@ -109,8 +109,8 @@ function! s:is_skip(event, context) abort "{{{ endif return 0 -endfunction"}}} -function! s:is_skip_text(event) abort "{{{ +endfunction +function! s:is_skip_text(event) abort let input = deoplete#util#get_input(a:event) let displaywidth = strdisplaywidth(input) + 1 @@ -129,22 +129,22 @@ function! s:is_skip_text(event) abort "{{{ return (!pumvisible() && virtcol('.') != displaywidth) \ || (a:event !=# 'Manual' && input != '' \ && index(skip_chars, input[-1:]) >= 0) -endfunction"}}} +endfunction -function! s:on_event(event) abort "{{{ +function! s:on_event(event) abort let context = deoplete#init#_context(a:event, []) call rpcnotify(g:deoplete#_channel_id, 'deoplete_on_event', context) -endfunction"}}} +endfunction -function! s:on_insert_leave() abort "{{{ +function! s:on_insert_leave() abort if exists('g:deoplete#_saved_completeopt') let &completeopt = g:deoplete#_saved_completeopt unlet g:deoplete#_saved_completeopt endif let g:deoplete#_context = {} -endfunction"}}} +endfunction -function! s:complete_done() abort "{{{ +function! s:complete_done() abort if get(v:completed_item, 'word', '') != '' let word = v:completed_item.word if !has_key(g:deoplete#_rank, word) @@ -155,9 +155,9 @@ function! s:complete_done() abort "{{{ endif let g:deoplete#_context.position = getpos('.') -endfunction"}}} +endfunction -function! s:on_insert_char_pre() abort "{{{ +function! s:on_insert_char_pre() abort if !pumvisible() \ || !g:deoplete#enable_refresh_always \ || s:is_skip_text('InsertCharPre') @@ -166,6 +166,4 @@ function! s:on_insert_char_pre() abort "{{{ " Auto refresh call feedkeys("\<Plug>(deoplete_auto_refresh)") -endfunction"}}} - -" vim: foldmethod=marker +endfunction diff --git a/autoload/deoplete/init.vim b/autoload/deoplete/init.vim index 062d5f0..956c1b4 100644 --- a/autoload/deoplete/init.vim +++ b/autoload/deoplete/init.vim @@ -8,14 +8,14 @@ if !exists('s:is_enabled') let s:is_enabled = 0 endif -function! deoplete#init#_is_enabled() abort "{{{ +function! deoplete#init#_is_enabled() abort return s:is_enabled -endfunction"}}} -function! s:is_initialized() abort "{{{ +endfunction +function! s:is_initialized() abort return exists('g:deoplete#_context') -endfunction"}}} +endfunction -function! deoplete#init#_initialize() abort "{{{ +function! deoplete#init#_initialize() abort if s:is_initialized() return endif @@ -30,8 +30,8 @@ function! deoplete#init#_initialize() abort "{{{ call deoplete#mapping#_init() call deoplete#init#_variables() -endfunction"}}} -function! deoplete#init#_channel() abort "{{{ +endfunction +function! deoplete#init#_channel() abort if !has('nvim') || !has('python3') call deoplete#util#print_error( \ 'deoplete.nvim does not work with this version.') @@ -67,19 +67,19 @@ function! deoplete#init#_channel() abort "{{{ \ 'Please update neovim-python by "pip3 install --upgrade neovim"') return 1 endif -endfunction"}}} -function! deoplete#init#_enable() abort "{{{ +endfunction +function! deoplete#init#_enable() abort call deoplete#handler#_init() let s:is_enabled = 1 -endfunction"}}} -function! deoplete#init#_disable() abort "{{{ +endfunction +function! deoplete#init#_disable() abort augroup deoplete autocmd! augroup END let s:is_enabled = 0 -endfunction"}}} +endfunction -function! deoplete#init#_variables() abort "{{{ +function! deoplete#init#_variables() abort let g:deoplete#_context = {} let g:deoplete#_rank = {} @@ -136,22 +136,22 @@ function! deoplete#init#_variables() abort "{{{ call deoplete#util#set_default( \ 'g:deoplete#member#prefix_patterns', {}) - " Initialize default keyword pattern. "{{{ + " Initialize default keyword pattern. call deoplete#util#set_pattern( \ g:deoplete#_keyword_patterns, \ '_', \ '[a-zA-Z_]\k*') - "}}} - " Initialize omni completion pattern. "{{{ + + " Initialize omni completion pattern. " Note: HTML omni func use search(). call deoplete#util#set_pattern( \ g:deoplete#_omni_patterns, \ 'html,xhtml,xml,markdown,mkd', ['<', '<[^>]*\s[[:alnum:]-]*']) - "}}} -endfunction"}}} -function! deoplete#init#_context(event, sources) abort "{{{ +endfunction + +function! deoplete#init#_context(event, sources) abort let filetype = (exists('*context_filetype#get_filetype') ? \ context_filetype#get_filetype() : \ (&filetype == '' ? 'nothing' : &filetype)) @@ -222,6 +222,4 @@ function! deoplete#init#_context(event, sources) abort "{{{ \ 'omni__omnifunc': &l:omnifunc, \ 'dict__dictionary': &l:dictionary, \ } -endfunction"}}} - -" vim: foldmethod=marker +endfunction diff --git a/autoload/deoplete/mapping.vim b/autoload/deoplete/mapping.vim index 18156fa..ddf591e 100644 --- a/autoload/deoplete/mapping.vim +++ b/autoload/deoplete/mapping.vim @@ -4,22 +4,22 @@ " License: MIT license "============================================================================= -function! deoplete#mapping#_init() abort "{{{ +function! deoplete#mapping#_init() abort inoremap <silent> <Plug>_ \ <C-r>=deoplete#mapping#_do_complete(g:deoplete#_context)<CR> inoremap <silent> <Plug>(deoplete_auto_refresh) \ <C-r>=deoplete#refresh()<CR> -endfunction"}}} +endfunction -function! deoplete#mapping#_do_complete(context) abort "{{{ +function! deoplete#mapping#_do_complete(context) abort if b:changedtick == get(a:context, 'changedtick', -1) \ && mode() ==# 'i' call complete(a:context.complete_position + 1, a:context.candidates) endif return '' -endfunction"}}} -function! deoplete#mapping#_set_completeopt() abort "{{{ +endfunction +function! deoplete#mapping#_set_completeopt() abort if exists('g:deoplete#_saved_completeopt') return endif @@ -30,12 +30,10 @@ function! deoplete#mapping#_set_completeopt() abort "{{{ if &completeopt !~# 'noinsert\|noselect' set completeopt+=noselect endif -endfunction"}}} -function! deoplete#mapping#_rpcnotify_wrapper(sources) abort "{{{ +endfunction +function! deoplete#mapping#_rpcnotify_wrapper(sources) abort call rpcrequest(g:deoplete#_channel_id, \ 'deoplete_manual_completion_begin', \ deoplete#init#_context('Manual', a:sources)) return '' -endfunction"}}} - -" vim: foldmethod=marker +endfunction diff --git a/autoload/deoplete/mappings.vim b/autoload/deoplete/mappings.vim index 30432a0..8f6d384 100644 --- a/autoload/deoplete/mappings.vim +++ b/autoload/deoplete/mappings.vim @@ -6,25 +6,23 @@ " For compatibility. -function! deoplete#mappings#manual_complete(...) abort "{{{ +function! deoplete#mappings#manual_complete(...) abort return call('deoplete#manual_complete', a:000) -endfunction"}}} +endfunction -function! deoplete#mappings#close_popup() abort "{{{ +function! deoplete#mappings#close_popup() abort return deoplete#close_popup() -endfunction"}}} -function! deoplete#mappings#smart_close_popup() abort "{{{ +endfunction +function! deoplete#mappings#smart_close_popup() abort return deoplete#smart_close_popup() -endfunction"}}} -function! deoplete#mappings#cancel_popup() abort "{{{ +endfunction +function! deoplete#mappings#cancel_popup() abort return deoplete#cancel_popup() -endfunction"}}} -function! deoplete#mappings#refresh() abort "{{{ +endfunction +function! deoplete#mappings#refresh() abort return deoplete#refresh() -endfunction"}}} +endfunction -function! deoplete#mappings#undo_completion() abort "{{{ +function! deoplete#mappings#undo_completion() abort return deoplete#undo_completion() -endfunction"}}} - -" vim: foldmethod=marker +endfunction diff --git a/autoload/deoplete/util.vim b/autoload/deoplete/util.vim index 7aa4479..a209363 100644 --- a/autoload/deoplete/util.vim +++ b/autoload/deoplete/util.vim @@ -4,23 +4,23 @@ " License: MIT license "============================================================================= -function! deoplete#util#set_default(var, val, ...) abort "{{{ +function! deoplete#util#set_default(var, val, ...) abort if !exists(a:var) || type({a:var}) != type(a:val) let alternate_var = get(a:000, 0, '') let {a:var} = exists(alternate_var) ? \ {alternate_var} : a:val endif -endfunction"}}} -function! deoplete#util#set_pattern(variable, keys, pattern) abort "{{{ +endfunction +function! deoplete#util#set_pattern(variable, keys, pattern) abort for key in split(a:keys, '\s*,\s*') if !has_key(a:variable, key) let a:variable[key] = a:pattern endif endfor -endfunction"}}} +endfunction function! deoplete#util#get_buffer_config( - \ filetype, buffer_var, user_var, default_var, ...) abort "{{{ + \ filetype, buffer_var, user_var, default_var, ...) abort let default_val = get(a:000, 0, '') if exists(a:buffer_var) @@ -32,30 +32,30 @@ function! deoplete#util#get_buffer_config( return get({a:user_var}, filetype, \ get(eval(a:default_var), filetype, default_val)) -endfunction"}}} -function! deoplete#util#get_simple_buffer_config(buffer_var, user_var) abort "{{{ +endfunction +function! deoplete#util#get_simple_buffer_config(buffer_var, user_var) abort return exists(a:buffer_var) ? {a:buffer_var} : {a:user_var} -endfunction"}}} -function! deoplete#util#print_error(string) abort "{{{ +endfunction +function! deoplete#util#print_error(string) abort echohl Error | echomsg '[deoplete] ' \ . deoplete#util#string(a:string) | echohl None -endfunction"}}} -function! deoplete#util#print_warning(string) abort "{{{ +endfunction +function! deoplete#util#print_warning(string) abort echohl WarningMsg | echomsg '[deoplete] ' \ . deoplete#util#string(a:string) | echohl None -endfunction"}}} -function! deoplete#util#print_debug(string) abort "{{{ +endfunction +function! deoplete#util#print_debug(string) abort echomsg '[deoplete] ' . deoplete#util#string(a:string) -endfunction"}}} +endfunction -function! deoplete#util#convert2list(expr) abort "{{{ +function! deoplete#util#convert2list(expr) abort return type(a:expr) ==# type([]) ? a:expr : [a:expr] -endfunction"}}} -function! deoplete#util#string(expr) abort "{{{ +endfunction +function! deoplete#util#string(expr) abort return type(a:expr) ==# type('') ? a:expr : string(a:expr) -endfunction"}}} +endfunction -function! deoplete#util#get_input(event) abort "{{{ +function! deoplete#util#get_input(event) abort let mode = mode() if a:event ==# 'InsertEnter' let mode = 'i' @@ -78,21 +78,21 @@ function! deoplete#util#get_input(event) abort "{{{ endif return input . complete_str -endfunction"}}} -function! deoplete#util#get_next_input(event) abort "{{{ +endfunction +function! deoplete#util#get_next_input(event) abort return getline('.')[len(deoplete#util#get_input(a:event)) :] -endfunction"}}} -function! deoplete#util#get_prev_event() abort "{{{ +endfunction +function! deoplete#util#get_prev_event() abort return get(g:deoplete#_context, 'event', '') -endfunction"}}} +endfunction -function! deoplete#util#vimoption2python(option) abort "{{{ +function! deoplete#util#vimoption2python(option) abort return '[a-zA-Z' . s:vimoption2python(a:option) . ']' -endfunction"}}} -function! deoplete#util#vimoption2python_not(option) abort "{{{ +endfunction +function! deoplete#util#vimoption2python_not(option) abort return '[^a-zA-Z' . s:vimoption2python(a:option) . ']' -endfunction"}}} -function! s:vimoption2python(option) abort "{{{ +endfunction +function! s:vimoption2python(option) abort let has_dash = 0 let patterns = [] for pattern in split(a:option, ',') @@ -117,9 +117,9 @@ function! s:vimoption2python(option) abort "{{{ endif return join(deoplete#util#uniq(patterns), '') -endfunction"}}} +endfunction -function! deoplete#util#uniq(list) abort "{{{ +function! deoplete#util#uniq(list) abort let list = map(copy(a:list), '[v:val, v:val]') let i = 0 let seen = {} @@ -133,9 +133,9 @@ function! deoplete#util#uniq(list) abort "{{{ endif endwhile return map(list, 'v:val[0]') -endfunction"}}} +endfunction -function! deoplete#util#redir(cmd) abort "{{{ +function! deoplete#util#redir(cmd) abort if exists('*execute') return execute(a:cmd) else @@ -147,9 +147,9 @@ function! deoplete#util#redir(cmd) abort "{{{ let [&verbose, &verbosefile] = [save_verbose, save_verbosefile] return res endif -endfunction"}}} +endfunction -function! deoplete#util#get_syn_names() abort "{{{ +function! deoplete#util#get_syn_names() abort if col('$') >= 200 return [] endif @@ -168,9 +168,9 @@ function! deoplete#util#get_syn_names() abort "{{{ " Ignore error endtry return names -endfunction"}}} +endfunction -function! deoplete#util#exists_omnifunc(name) abort "{{{ +function! deoplete#util#exists_omnifunc(name) abort if !exists('s:called_omnifuncs') let s:called_omnifuncs = {} endif @@ -180,14 +180,14 @@ function! deoplete#util#exists_omnifunc(name) abort "{{{ let s:called_omnifuncs[a:name] = exists('*' . a:name) endif return s:called_omnifuncs[a:name] -endfunction"}}} +endfunction -function! deoplete#util#neovim_version() abort "{{{ +function! deoplete#util#neovim_version() abort redir => v silent version redir END return split(v, '\n')[0] -endfunction"}}} +endfunction " Compare versions. Return values is the distance between versions. Each " version integer (from right to left) is an ascending power of 100. @@ -200,7 +200,7 @@ endfunction"}}} " <0 if a < b " >0 if a > b " 0 if versions are equal. -function! deoplete#util#versioncmp(a, b) abort "{{{ +function! deoplete#util#versioncmp(a, b) abort let a = map(split(a:a, '\.'), 'str2nr(v:val)') let b = map(split(a:b, '\.'), 'str2nr(v:val)') let l = min([len(a), len(b)]) @@ -212,6 +212,4 @@ function! deoplete#util#versioncmp(a, b) abort "{{{ endfor return d -endfunction"}}} - -" vim: foldmethod=marker +endfunction |