Correction : vim : affiche tous les complètements.
[tool/hledger.git] / vim / config / neocomplcache.vim
1 " Disable automatic completion popup
2 let g:neocomplcache_disable_auto_complete = 1
3 " Disable AutoComplPop.
4 let g:acp_enableAtStartup = 0
5 " Use neocomplcache.
6 let g:neocomplcache_enable_at_startup = 1
7 " Use smartcase.
8 let g:neocomplcache_enable_smart_case = 1
9 " Set minimum syntax keyword length.
10 let g:neocomplcache_min_syntax_length = 2
11 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
12 let g:neocomplcache_max_list = 0
13
14 " Define dictionary.
15 let g:neocomplcache_dictionary_filetype_lists = {
16 \ 'default' : '',
17 \ 'vimshell' : $HOME.'/.vimshell_hist',
18 \ 'scheme' : $HOME.'/.gosh_completions'
19 \ }
20
21 " Define keyword.
22 if !exists('g:neocomplcache_keyword_patterns')
23 let g:neocomplcache_keyword_patterns = {}
24 endif
25 let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
26
27 " Plugin key-mappings.
28 inoremap <expr><C-g> neocomplcache#undo_completion()
29 inoremap <expr><C-l> neocomplcache#complete_common_string()
30
31 " Complete with <Tab>.
32 "inoremap <expr><TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : "\<C-x>\<C-u>"
33 inoremap <expr><TAB> pumvisible() ? neocomplcache#complete_common_string() : <SID>check_back_space() ? "\<TAB>" : "\<C-x>\<C-u>"
34
35 function! s:check_back_space()
36 let col = col('.') - 1
37 return !col || getline('.')[col - 1] =~ '\s'
38 endfunction
39
40 " Choose candidate with <CR>.
41 inoremap <expr><CR> neocomplcache#smart_close_popup() . “\<CR>”
42
43 " Recommended key-mappings.
44 " <CR>: close popup and save indent.
45 inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
46 function! s:my_cr_function()
47 return neocomplcache#smart_close_popup() . "\<CR>"
48 " For no inserting <CR> key.
49 "return pumvisible() ? neocomplcache#close_popup() : "\<CR>"
50 endfunction
51 " <TAB>: completion.
52 "inoremap <expr><TAB> pumvisible() ? neocomplcache#complete_common_string() : "\<TAB>"
53 "inoremap <expr><TAB> neocomplcache#complete_common_string()
54 " <C-h>, <BS>: close popup and delete backword char.
55 inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
56 inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
57 inoremap <expr><C-y> neocomplcache#close_popup()
58 inoremap <expr><C-e> neocomplcache#cancel_popup()
59 " Close popup by <Space>.
60 inoremap <expr><Space> pumvisible() ? neocomplcache#close_popup() : "\<Space>"
61
62 " Sort choices by bytes
63 call neocomplcache#custom_source('_', 'sorters', ['sorter_bytes'])
64
65 " For cursor moving in insert mode(Not recommended)
66 "inoremap <expr><Left> neocomplcache#close_popup() . "\<Left>"
67 "inoremap <expr><Right> neocomplcache#close_popup() . "\<Right>"
68 "inoremap <expr><Up> neocomplcache#close_popup() . "\<Up>"
69 "inoremap <expr><Down> neocomplcache#close_popup() . "\<Down>"
70 " Or set this.
71 "let g:neocomplcache_enable_cursor_hold_i = 1
72 " Or set this.
73 "let g:neocomplcache_enable_insert_char_pre = 1
74
75 " AutoComplPop like behavior.
76 "let g:neocomplcache_enable_auto_select = 1
77
78 " Enable heavy features.
79 " Use camel case completion.
80 "let g:neocomplcache_enable_camel_case_completion = 1
81 " Use underbar completion.
82 let g:neocomplcache_enable_underbar_completion = 1
83
84 " Shell like behavior(not recommended).
85 "set completeopt+=longest
86 "let g:neocomplcache_enable_auto_select = 1
87 "let g:neocomplcache_disable_auto_complete = 1
88 "inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
89
90 " Enable omni completion.
91 autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
92 autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
93 autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
94 autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
95 autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
96
97 " Enable heavy omni completion.
98 if !exists('g:neocomplcache_omni_patterns')
99 let g:neocomplcache_omni_patterns = {}
100 endif
101 let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
102 let g:neocomplcache_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
103 let g:neocomplcache_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
104
105 " For perlomni.vim setting.
106 " https://github.com/c9s/perlomni.vim
107 let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
108 runtime plugin/neocomplcache.vim