summaryrefslogtreecommitdiff
path: root/autoload/deoplete/handler.vim
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2020-10-22 09:49:09 +0900
committerShougo Matsushita <Shougo.Matsu@gmail.com>2020-10-22 09:49:09 +0900
commit80152d0940b0d572711b0c89c6c2f1af7a0faaa9 (patch)
tree064f9e705f546823cf6eacdd6ee3de963016d1e5 /autoload/deoplete/handler.vim
parent89eadb5ea0fca99f1e56c7969bfbdc3b8581822e (diff)
downloaddeoplete.nvim-80152d0940b0d572711b0c89c6c2f1af7a0faaa9.zip
Fix #1139 indentkeys problem
Diffstat (limited to 'autoload/deoplete/handler.vim')
-rw-r--r--autoload/deoplete/handler.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim
index 0c6812c..86a0d8e 100644
--- a/autoload/deoplete/handler.vim
+++ b/autoload/deoplete/handler.vim
@@ -291,6 +291,11 @@ function! s:is_skip_text(event) abort
endif
endif
+ if s:matched_indentkeys(input) !=# ''
+ call deoplete#util#indent_current_line()
+ return 1
+ endif
+
let skip_chars = deoplete#custom#_get_option('skip_chars')
return (a:event !=# 'Manual' && input !=# ''
@@ -299,6 +304,24 @@ endfunction
function! s:check_input_method() abort
return exists('*getimstatus') && getimstatus()
endfunction
+function! s:matched_indentkeys(input) abort
+ for word in filter(map(split(&l:indentkeys, ','),
+ \ "v:val =~# '^<.*>$' ? matchstr(v:val, '^<\\zs.*\\ze>$')
+ \ : matchstr(v:val, ':\\|e\\|=\\zs.*')"),
+ \ "v:val !=# ''")
+
+ if word ==# 'e'
+ let word = 'else'
+ endif
+
+ let lastpos = len(a:input) - len(word)
+ if lastpos >= 0 && strridx(a:input, word) == lastpos
+ return word
+ endif
+ endfor
+
+ return ''
+endfunction
function! s:define_on_event(event) abort
if !exists('##' . a:event)