deoplete.vim 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. " Enable deoplete
  2. let g:deoplete#enable_at_startup = 1
  3. let g:deoplete#complete_method = "omnifunc"
  4. let g:deoplete#auto_complete_delay = 0
  5. ""let g:deoplete#max_menu_width = 10
  6. " let g:deoplete#ignore_sources = ['buffer']
  7. " Close previews immediately
  8. autocmd CompleteDone * silent! pclose!
  9. "better nav for omnicomplete
  10. inoremap <expr> <c-j> ("\<C-n>")
  11. inoremap <expr> <c-k> ("\<C-p>")
  12. "<TAB>: completion.
  13. ""inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  14. "use TAB as the mapping
  15. inoremap <silent><expr> <TAB>
  16. \ pumvisible() ? "\<C-n>" :
  17. \ <SID>check_back_space() ? "\<TAB>" :
  18. \ deoplete#mappings#manual_complete()
  19. function! s:check_back_space() abort ""
  20. let col = col('.') - 1
  21. return !col || getline('.')[col - 1] =~ '\s'
  22. endfunction ""
  23. inoremap <silent><expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
  24. inoremap <expr><BS> deoplete#smart_close_popup()."\<C-h>"
  25. call deoplete#custom#option('sources', {
  26. \ 'python': ['file', 'LanguageClient', 'neosnippet'],
  27. \ })
  28. " Sort matches alphabetically
  29. call deoplete#custom#source('_', 'sorters', ['sorter_word'])
  30. " Disable shorter or equal length matches
  31. call deoplete#custom#source('_', 'matchers', ['matcher_fuzzy', 'matcher_length'])