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