deoplete.vim 1.2 KB

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