Shougo / neocomplcache.vim

Ultimate auto-completion system for Vim.
http://www.vim.org/scripts/script.php?script_id=2620
1.72k stars 135 forks source link

Enable snippets at startup #452

Closed jboadas closed 11 years ago

jboadas commented 11 years ago

I have neocomplcache/neosnippet installed on gVim Windows Machine and create some templates in _.snip, when I open vim in the first empty buffer I try to get the neocomplcache menu with tab on my custom snippet and also try with date and no menu only get completefunc on command line. then I put the command let g:neocomplcache_disable_auto_complete = 0 in my vimrc restar vim and menu is working fine, My issue is : there is a way to enable the menu with tab in the initial empty buffer ?. here is my conf :

"Begin Neocomplcache --------------------------------

let g:acp_enableAtStartup = 0
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_smart_case = 1
let g:neocomplcache_min_syntax_length = 2
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_dictionary_filetype_lists = {
        \ 'default' : '',
        \ 'vimshell' : $HOME.'/.vimshell_hist',
        \ 'scheme' : $HOME.'/.gosh_completions'
        \ }

inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
    return pumvisible() ? neocomplcache#close_popup() : "\<CR>"
endfunction

inoremap <expr><TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : "\<C-x>\<C-u>"
function! s:check_back_space()"{{{
    let col = col('.') - 1
    return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><Space> pumvisible() ? neocomplcache#close_popup() : "\<Space>"
let g:neocomplcache_enable_insert_char_pre = 1
let g:neocomplcache_enable_auto_select = 0
set omnifunc=syntaxcomplete#Complete
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype javascript setlocal ts=4 sts=4 sw=4
if !exists('g:neocomplcache_omni_patterns')
    let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
let g:neocomplcache_disable_auto_complete = 1
inoremap <expr><C-l> neocomplcache#complete_common_string()
set completeopt-=preview
set completeopt+=longest

"" End neocomplcache ----------------------------------------------------

"Begin neosnippet ************************************************************

imap <C-k>     <Plug>(neosnippet_expand_or_jump)
smap <C-k>     <Plug>(neosnippet_expand_or_jump)
xmap <C-k>     <Plug>(neosnippet_expand_target)

"End neosnippet **************************************************************

Thanks

Shougo commented 11 years ago
call neosnippet#initialize()
call neocomplcache#initialize()
jboadas commented 11 years ago

Sorry didn't work and if you open a file with the context menu "Edit with Vim" (any file) you keep getting "Completefunc not set" until you open a file with "e:"

Shougo commented 11 years ago

I fixed it.

jboadas commented 11 years ago

Awesome! now works thanks