Skip to content

Commit

Permalink
vim: Better tab completion for deoplete
Browse files Browse the repository at this point in the history
  • Loading branch information
shazow committed Dec 26, 2015
1 parent 50a984e commit 9546228
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions .vimrc.bundles
Expand Up @@ -26,30 +26,29 @@ Plug 'alvan/vim-closetag' " Auto-close HTML tags
Plug 'itchyny/lightline.vim'

"" Language support
if $GOPATH != ""
Plug 'fatih/vim-go'
Plug 'rhysd/vim-go-impl'
endif
Plug 'Shougo/deoplete.nvim' " Replaces neocomplcache
Plug 'Shougo/neosnippet'
Plug 'janko-m/vim-test'
Plug 'leshill/vim-json'
Plug 'plasticboy/vim-markdown'
Plug 'hdima/python-syntax'
Plug 'hynek/vim-python-pep8-indent'
Plug 'davidhalter/jedi-vim' " Python static analysis engine
Plug 'jmcantrell/vim-virtualenv'
Plug 'plasticboy/vim-markdown'
Plug 'Shougo/deoplete.nvim' " Replaces neocomplcache
Plug 'Shougo/neopairs.vim' " Close parens
if $GOPATH != ""
Plug 'fatih/vim-go'
Plug 'rhysd/vim-go-impl'
endif

"" Syntax highlighting
Plug 'hail2u/vim-css3-syntax'
Plug 'pangloss/vim-javascript'
Plug 'othree/html5.vim'
Plug 'ap/vim-css-color'
Plug 'sophacles/vim-bundle-mako'
Plug 'groenewege/vim-less'
Plug 'sophacles/vim-bundle-mako', { 'for': 'mako' }
Plug 'groenewege/vim-less', { 'for': 'less' }
Plug 'honza/dockerfile.vim'
Plug 'Shougo/neosnippet'
Plug 'tikhomirov/vim-glsl'
Plug 'tikhomirov/vim-glsl', { 'for': 'glsl' }
Plug 'vim-scripts/rfc-syntax', { 'for': 'rfc' } " optional syntax highlighting for RFC files

"" Colorschemes
Expand Down Expand Up @@ -129,18 +128,29 @@ autocmd FileType mako let b:match_words = '<\(\w\w*\):</\1,{:}'
autocmd FileType python setlocal omnifunc=jedi#completions
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
autocmd FileType go setlocal omnifunc=gocomplete#Complete
" }

" deoplete {
let g:deoplete#enable_at_startup = 1

" Tab-complete
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" : "\<TAB>"
" deoplete-go
set completeopt+=noinsert
set completeopt+=noselect

" Tab-complete, without completing on an empty line.
function! s:check_back_space()
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction

imap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#mappings#manual_complete()
"inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"

" Use head matcher instead of fuzzy matcher
call deoplete#custom#set('_', 'matchers', ['matcher_head'])
"call deoplete#custom#set('_', 'matchers', ['matcher_head'])

" doplete + vim-jedi for Python
"let g:jedi#completions_enabled = 0
Expand Down

0 comments on commit 9546228

Please sign in to comment.