forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeoplete.vim
More file actions
171 lines (143 loc) · 5.66 KB
/
deoplete.vim
File metadata and controls
171 lines (143 loc) · 5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
" deoplete
" ---
" call deoplete#custom#option('profile', v:true)
" call deoplete#enable_logging('DEBUG', 'deoplete.log')<CR>
" call deoplete#custom#source('tern', 'debug_enabled', 1)<CR>
" General settings " {{{
" ---
call deoplete#custom#option({
\ 'auto_refresh_delay': 10,
\ 'camel_case': v:true,
\ 'skip_multibyte': v:true,
\ 'prev_completion_mode': 'none',
\ 'min_pattern_length': 1,
\ 'max_list': 10000,
\ 'skip_chars': ['(', ')', '<', '>'],
\ })
"\ 'prev_completion_mode': 'filter',
" Deoplete Jedi (python) settings
let g:deoplete#sources#jedi#statement_length = 30
let g:deoplete#sources#jedi#show_docstring = 1
let g:deoplete#sources#jedi#short_types = 1
" Deoplete TernJS settings
let g:deoplete#sources#ternjs#filetypes = [
\ 'jsx',
\ 'javascript',
\ 'javascript.jsx',
\ 'vue',
\ ]
let g:deoplete#sources#ternjs#timeout = 3
let g:deoplete#sources#ternjs#types = 1
let g:deoplete#sources#ternjs#docs = 1
" }}}
" Limit Sources " {{{
" ---
" }}}
" Omni functions and patterns " {{{
" ---
if ! exists('g:context_filetype#same_filetypes')
let g:context_filetype#filetypes = {}
endif
let g:context_filetype#filetypes.svelte = [
\ { 'filetype': 'css', 'start': '<style>', 'end': '</style>' },
\ ]
call deoplete#custom#var('omni', 'functions', {
\ 'css': [ 'csscomplete#CompleteCSS' ]
\ })
call deoplete#custom#option('omni_patterns', {
\ 'go': '[^. *\t]\.\w*',
\})
" }}}
" Ranking and Marks " {{{
" Default rank is 100, higher is better.
call deoplete#custom#source('omni', 'mark', '<omni>')
call deoplete#custom#source('flow', 'mark', '<flow>')
call deoplete#custom#source('padawan', 'mark', '<php>')
call deoplete#custom#source('tern', 'mark', '<tern>')
call deoplete#custom#source('go', 'mark', '<go>')
call deoplete#custom#source('jedi', 'mark', '<jedi>')
call deoplete#custom#source('vim', 'mark', '<vim>')
call deoplete#custom#source('neosnippet', 'mark', '<snip>')
call deoplete#custom#source('tag', 'mark', '<tag>')
call deoplete#custom#source('around', 'mark', '<around>')
call deoplete#custom#source('buffer', 'mark', '<buf>')
call deoplete#custom#source('tmux-complete', 'mark', '<tmux>')
call deoplete#custom#source('syntax', 'mark', '<syntax>')
call deoplete#custom#source('member', 'mark', '<member>')
call deoplete#custom#source('padawan', 'rank', 660)
call deoplete#custom#source('go', 'rank', 650)
call deoplete#custom#source('vim', 'rank', 640)
call deoplete#custom#source('flow', 'rank', 630)
call deoplete#custom#source('TernJS', 'rank', 620)
call deoplete#custom#source('jedi', 'rank', 610)
call deoplete#custom#source('omni', 'rank', 600)
call deoplete#custom#source('neosnippet', 'rank', 510)
call deoplete#custom#source('member', 'rank', 500)
call deoplete#custom#source('file_include', 'rank', 420)
call deoplete#custom#source('file', 'rank', 410)
call deoplete#custom#source('tag', 'rank', 400)
call deoplete#custom#source('around', 'rank', 330)
call deoplete#custom#source('buffer', 'rank', 320)
call deoplete#custom#source('dictionary', 'rank', 310)
call deoplete#custom#source('tmux-complete', 'rank', 300)
call deoplete#custom#source('syntax', 'rank', 50)
" }}}
" Matchers and Converters " {{{
" ---
" Default sorters: ['sorter/rank']
" Default matchers: ['matcher/length', 'matcher/fuzzy']
call deoplete#custom#source('_', 'matchers',
\ [ 'matcher_fuzzy', 'matcher_length' ])
call deoplete#custom#source('_', 'converters', [
\ 'converter_remove_paren',
\ 'converter_remove_overlap',
\ 'converter_truncate_abbr',
\ 'converter_truncate_menu',
\ ])
call deoplete#custom#source('denite', 'matchers',
\ ['matcher_full_fuzzy', 'matcher_length'])
" }}}
" Key-mappings and Events " {{{
" ---
augroup user_plugin_deoplete
autocmd!
autocmd CompleteDone * silent! pclose!
augroup END
" Movement within 'ins-completion-menu'
imap <expr><C-j> pumvisible() ? "\<Down>" : "\<C-j>"
imap <expr><C-k> pumvisible() ? "\<Up>" : "\<C-k>"
" Scroll pages in menu
inoremap <expr><C-f> pumvisible() ? "\<PageDown>" : "\<Right>"
inoremap <expr><C-b> pumvisible() ? "\<PageUp>" : "\<Left>"
imap <expr><C-d> pumvisible() ? "\<PageDown>" : "\<C-d>"
imap <expr><C-u> pumvisible() ? "\<PageUp>" : "\<C-u>"
" Undo completion
" inoremap <expr><C-g> deoplete#undo_completion()
" Redraw candidates
inoremap <expr><C-g> deoplete#manual_complete()
inoremap <expr><C-e> deoplete#cancel_popup()
inoremap <silent><expr><C-l> deoplete#complete_common_string()
" <CR>: If popup menu visible, expand snippet or close popup with selection,
" Otherwise, check if within empty pair and use delimitMate.
inoremap <silent><expr><CR> pumvisible() ? deoplete#close_popup()
\ : (delimitMate#WithinEmptyPair() ? "\<C-R>=delimitMate#ExpandReturn()\<CR>" : "\<CR>")
" <Tab> completion:
" 1. If popup menu is visible, select and insert next item
" 2. Otherwise, if within a snippet, jump to next input
" 3. Otherwise, if preceding chars are whitespace, insert tab char
" 4. Otherwise, start manual autocomplete
imap <silent><expr><Tab> pumvisible() ? "\<Down>"
\ : (neosnippet#jumpable() ? "\<Plug>(neosnippet_jump)"
\ : (<SID>is_whitespace() ? "\<Tab>"
\ : deoplete#manual_complete()))
smap <silent><expr><Tab> pumvisible() ? "\<Down>"
\ : (neosnippet#jumpable() ? "\<Plug>(neosnippet_jump)"
\ : (<SID>is_whitespace() ? "\<Tab>"
\ : deoplete#manual_complete()))
inoremap <expr><S-Tab> pumvisible() ? "\<Up>" : "\<C-h>"
function! s:is_whitespace() "{{{
let col = col('.') - 1
return ! col || getline('.')[col - 1] =~ '\s'
endfunction "}}}
" }}}
" vim: set foldmethod=marker ts=2 sw=2 tw=80 noet :