The documentation provides an example of disabling auto complete and using <Tab> to manually complete:
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" : deoplete#manual_complete()
However, this prevents the <Tab> character from actually being used for spacing
Provide example that does not clobber <Tab> functionality on failure, or allow manual complete to be triggered by appropriate pattern (e.g. not at the start of a line or under a space).
:CheckHealth result(neovim ver.0.1.5-452+):Checking: Python 2
Executable: /usr/bin/python2.7
Python Version: 2.7.10
python2.7-neovim Version: not found (unknown)
Messages:
* Warning: No Python interpreter was found with the neovim module. Using
the first available for diagnostics.
* provider/pythonx: Could not load Python 2:
python2 not found in search path or not executable.
/usr/bin/python2.7 does have not have the neovim module installed. See
":help nvim-python".
/usr/bin/python2.6 does have not have the neovim module installed. See
":help nvim-python".
/usr/bin/python does have not have the neovim module installed. See
":help nvim-python".
* Warning: "g:python_host_prog" is not set. Searching for python2.7 in
the environment.
* Error: Neovim Python client is not installed.
Checking: Python 3
Executable: /usr/local/bin/python3
Python Version: 3.5.2
python3-neovim Version: 0.1.9 (up to date)
Messages:
* Warning: "g:python3_host_prog" is not set. Searching for python3 in
the environment.
Checking: Remote Plugins
Status: Out of date
Messages:
* ".dein" is not registered.
* Run :UpdateRemotePlugins
set t_Co=256
call pathogen#infect()
set nocompatible " Not like Vi
set autoread " detect when file is changed
set ttyfast " faster redraw
set nolazyredraw " don't redraw when executing macros
set autoindent " autoidentation on
set smartindent " smartindentation on
set showmatch " blink back to closing bracket (using % key)
set shell=$SHELL
set title " terminal title
set background=dark " highlighting depends on background color (dark or light)
set nowrapscan " turn off search wrapping
set ignorecase " ignore case in search
set smartcase " consider case only when typing Uppercase
set hlsearch " highlight search pattern
set vb t_vb= " don't notify (no audio/visual bell)
set showmode " display mode INSERT/REPLACE/...
set scrolloff=3 " dont let the curser get too close to the edge
set laststatus=2 " laststatus: show status line? Yes, always!
set nonumber " no line numbers
set expandtab " Expand Tabs (pressing Tab inserts spaces)
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set list listchars=tab:>- " visual display of tabs
set complete+=k " dictionary scanning
set bs=2 " backspace ???
set exrc
set secure
set nofoldenable " folding is over!
retab " force all Tab characters to match current Tab preferences
filetype plugin on " idk what this does, but it seems important
syntax on " Enable syntax highlighting
set omnifunc=syntaxcomplete#Complete
set runtimepath^=~/.config/nvim/dein/repos/github.com/Shougo/dein.vim
call dein#begin(expand('~/.config/nvim/dein'))
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/deoplete.nvim')
call dein#add('carlitux/deoplete-ternjs')
call dein#add('tweekmonster/nvim-checkhealth')
call dein#end()
let g:deoplete#disable_auto_complete = 1
let b:SuperTabDisabled = 1
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" : deoplete#manual_complete()
autocmd CompleteDone * pclose!
let g:SuperTabDefaultCompletionType = "<c-n>"
Update your vim configuration with the inoremap for <Tab> from the example in the docs:
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" : deoplete#manual_complete()
Notice that when you <Tab> at the start of a line or with space under the cursor, it does not indent.
Fixed.
Use this instead:
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#mappings#manual_complete()
function! s:check_back_space() abort "{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
NB for people potentially tearing their hair out: Using <tab> for completion is interfered with by UltiSnip's let g:UltiSnipsExpandTrigger, which defaults to <tab>. Set it to something else and you're good to go.
Is there any way to change this solution so that it first checks to see if there is a snippet for Ultisnips, and then if there is call that snippet completion before deoplete?
Unfortunately I don't know about Ultisnips API.
You can ask it in Ultisnips issues.
You can use the snippet for it.
Note: I have recovered it from reddit.
inoremap <silent> <tab> <c-r>=MyUltisnipsJump()<cr>
function! MyUltisnipsJump() abort
if pumvisible()
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res == 1
return ''
endif
return "\<C-y>"
endif
call UltiSnips#JumpForwards()
if g:ulti_jump_forwards_res == 1
return ''
endif
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res == 1
return ''
endif
return "\<tab>"
endfunction
It seems ugly hack though.
I use neosnippet instead. If you really integrate with deoplete, neosnippet is recommended.
Most helpful comment
Use this instead: