forked from vim-scripts/AutoComplPop
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsacp.vim
More file actions
61 lines (43 loc) · 1.71 KB
/
sacp.vim
File metadata and controls
61 lines (43 loc) · 1.71 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
let g:sacpEnable = get(g:,'sacpEnable',1)
if g:sacpEnable == 0
finish
endif
inoremap <expr> <silent> <Plug>(sacp_cache_fuzzy_omnicomplete) sacp#setupCacheFuzzyOmniComplete()."\<C-X>\<C-O>"
let s:sacpDefaultFileTypesEnable = { "php":1, "markdown":1, "text":1, "go":1}
let g:sacpDefaultFileTypesEnable = get(g:,'sacpDefaultFileTypesEnable',s:sacpDefaultFileTypesEnable)
" php
if get(g:sacpDefaultFileTypesEnable,'php',0) == 1
" TODO auto filename completion pop up, for './' '/' '../'
autocmd FileType php,php5,php7 call sacp#enableForThisBuffer({ "matches": [
\ { '=~': '\v[a-zA-Z]{4}$', 'feedkeys': "\<C-x>\<C-o>"},
\ { '=~': '::$' , 'feedkeys': "\<C-x>\<C-o>"},
\ { '=~': '->$' , 'feedkeys': "\<C-x>\<C-o>"},
\ ]
\ })
endif
" .md files
if get(g:sacpDefaultFileTypesEnable,'markdown',0) == 1
autocmd FileType markdown call sacp#enableForThisBuffer({ "matches": [
\ { '=~': '\v[a-zA-Z]{2}$', 'feedkeys': "\<C-x>\<C-n>"},
\ ]
\ })
endif
" .txt files
if get(g:sacpDefaultFileTypesEnable,'text',0) == 1
autocmd FileType text call sacp#enableForThisBuffer({ "matches": [
\ { '=~': '\v[a-zA-Z]{2}$', 'feedkeys': "\<C-x>\<C-n>"},
\ ]
\ })
endif
" golang
if get(g:sacpDefaultFileTypesEnable,'go',0) == 1
" 1. variables are all defined in current scope, use keyword from current
" buffer for completion `<C-x><C-n>`
" 2. When the '.' is pressed, use smarter omnicomplete `<C-x><C-o>`, this
" works well with the vim-go plugin
autocmd FileType go call sacp#enableForThisBuffer({ "matches": [
\ { '=~': '\v[a-zA-Z]{2}$' , 'feedkeys': "\<C-x>\<C-n>"} ,
\ { '=~': '\.$' , 'feedkeys': "\<C-x>\<C-o>", "ignoreCompletionMode":1} ,
\ ]
\ })
endif