forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deoplete.vim
185 lines (154 loc) · 6.96 KB
/
deoplete.vim
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
" deoplete for nvim
" ---
" let g:deoplete#enable_profile = 1
" call deoplete#enable_logging('DEBUG', 'deoplete.log')<CR>
" call deoplete#custom#source('tern', 'debug_enabled', 1)<CR>
" General settings " {{{
" ---
" let g:deoplete#auto_complete_delay = 50 " Default is 50
" let g:deoplete#auto_refresh_delay = 500 " Default is 500
let g:deoplete#enable_refresh_always = 0
let g:deoplete#enable_camel_case = 1
let g:deoplete#max_abbr_width = 35
let g:deoplete#max_menu_width = 20
let g:deoplete#skip_chars = ['(', ')', '<', '>']
let g:deoplete#tag#cache_limit_size = 800000
let g:deoplete#file#enable_buffer_path = 1
let g:deoplete#sources#jedi#statement_length = 30
let g:deoplete#sources#jedi#show_docstring = 1
let g:deoplete#sources#jedi#short_types = 1
let g:deoplete#sources#ternjs#filetypes = [
\ 'jsx',
\ 'javascript.jsx',
\ 'vue',
\ 'javascript'
\ ]
let g:deoplete#sources#ternjs#timeout = 3
let g:deoplete#sources#ternjs#types = 1
let g:deoplete#sources#ternjs#docs = 1
call deoplete#custom#source('_', 'min_pattern_length', 2)
" }}}
" Limit Sources " {{{
" ---
let g:deoplete#sources = get(g:, 'deoplete#sources', {})
let g:deoplete#sources.go = ['vim-go']
" let g:deoplete#sources.javascript = ['file', 'ternjs']
" let g:deoplete#sources.jsx = ['file', 'ternjs']
let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {})
" let g:deoplete#ignore_sources.html = ['syntax']
" let g:deoplete#ignore_sources.python = ['syntax']
" let g:deoplete#ignore_sources.php = ['omni']
" call deoplete#custom#source('_', 'disabled_syntaxes', ['Comment', 'String'])
" }}}
" Omni functions and patterns " {{{
" ---
" let g:deoplete#keyword_patterns = {}
" let g:deoplete#keyword_patterns._ = '[a-zA-Z_]\k*\(?'
let g:deoplete#omni#functions = get(g:, 'deoplete#omni#functions', {})
let g:deoplete#omni#functions.css = 'csscomplete#CompleteCSS'
let g:deoplete#omni#functions.html = 'htmlcomplete#CompleteTags'
let g:deoplete#omni#functions.markdown = 'htmlcomplete#CompleteTags'
" let g:deoplete#omni#functions.javascript =
" \ [ 'tern#Complete', 'jspc#omni', 'javascriptcomplete#CompleteJS' ]
let g:deoplete#omni_patterns = get(g:, 'deoplete#omni_patterns', {})
let g:deoplete#omni_patterns.html = '<[^>]*'
" let g:deoplete#omni_patterns.javascript = '[^. *\t]\.\w*'
" let g:deoplete#omni_patterns.javascript = '[^. \t]\.\%\(\h\w*\)\?'
let g:deoplete#omni_patterns.php =
\ '\h\w*\|[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?'
let g:deoplete#omni#input_patterns = get(g:, 'deoplete#omni#input_patterns', {})
let g:deoplete#omni#input_patterns.xml = '<[^>]*'
let g:deoplete#omni#input_patterns.md = '<[^>]*'
let g:deoplete#omni#input_patterns.css = '^\s\+\w\+\|\w\+[):;]\?\s\+\w*\|[@!]'
let g:deoplete#omni#input_patterns.scss = '^\s\+\w\+\|\w\+[):;]\?\s\+\w*\|[@!]'
let g:deoplete#omni#input_patterns.sass = '^\s\+\w\+\|\w\+[):;]\?\s\+\w*\|[@!]'
let g:deoplete#omni#input_patterns.python = ''
let g:deoplete#omni#input_patterns.javascript = ''
" }}}
" Ranking and Marks " {{{
" Default rank is 100, higher is better.
call deoplete#custom#source('omni', 'mark', '⌾')
call deoplete#custom#source('flow', 'mark', '⌁')
call deoplete#custom#source('padawan', 'mark', '⌁')
call deoplete#custom#source('TernJS', 'mark', '⌁')
call deoplete#custom#source('go', 'mark', '⌁')
call deoplete#custom#source('jedi', 'mark', '⌁')
call deoplete#custom#source('vim', 'mark', '⌁')
call deoplete#custom#source('neosnippet', 'mark', '⌘')
call deoplete#custom#source('tag', 'mark', '⌦')
call deoplete#custom#source('around', 'mark', '↻')
call deoplete#custom#source('buffer', 'mark', 'ℬ')
call deoplete#custom#source('tmux-complete', 'mark', '⊶')
call deoplete#custom#source('syntax', 'mark', '♯')
call deoplete#custom#source('member', 'mark', '.')
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', 200)
" }}}
" Matchers and Converters " {{{
" ---
" Default sorters: ['sorter_rank']
" Default matchers: ['matcher_length', 'matcher_fuzzy']
call deoplete#custom#source('_', 'converters', [
\ 'converter_remove_paren',
\ 'converter_remove_overlap',
\ 'converter_truncate_abbr',
\ 'converter_truncate_menu',
\ 'converter_auto_delimiter',
\ ])
" }}}
" Key-mappings and Events " {{{
" ---
autocmd MyAutoCmd CompleteDone * silent! pclose!
" 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#refresh()
inoremap <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() ?
\ (neosnippet#expandable() ? neosnippet#mappings#expand_impl() : 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 :