From 4ba95e6ff394d51b8b6e53c32d5dfe4e4b824fc2 Mon Sep 17 00:00:00 2001 From: yan Date: Thu, 15 Dec 2011 20:01:18 -0800 Subject: [PATCH] Fix neocompletion with ruby --- vim/plugin/settings/neocomplcache.vim | 31 ++++++++++++++++++++++----- vimrc | 8 +++---- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/vim/plugin/settings/neocomplcache.vim b/vim/plugin/settings/neocomplcache.vim index 9c7a176..6f29a38 100644 --- a/vim/plugin/settings/neocomplcache.vim +++ b/vim/plugin/settings/neocomplcache.vim @@ -1,18 +1,39 @@ " neocomplcache " A beter autocomplete system! + let g:neocomplcache_enable_at_startup = 1 let g:neocomplcache_enable_camel_case_completion = 1 let g:neocomplcache_enable_underbar_completion = 1 let g:neocomplcache_enable_smart_case = 1 " default # of completions is 100, that's crazy -let g:neocomplcache_max_list = 5 +let g:neocomplcache_max_list = 5 " words less than 3 letters long aren't worth completing let g:neocomplcache_auto_completion_start_length = 3 -" tab completion (from neocomplcache docs) -imap neocomplcache#sources#snippets_complete#expandable() ? "\(neocomplcache_snippets_expand)" : pumvisible() ? "\" : "\" +" Choose completions using Apple-Space +inoremap pumvisible() ? "\" : "\" -" Choose completions using Apple-Space -inoremap pumvisible() ? "\" : "\" +" This makes sure we use neocomplcache completefunc instead of +" the one in rails.vim, otherwise this plugin will crap out +let g:neocomplcache_force_overwrite_completefunc = 1 + +" Define keyword. +if !exists('g:neocomplcache_keyword_patterns') + let g:neocomplcache_keyword_patterns = {} +endif +let g:neocomplcache_keyword_patterns['default'] = '\h\w*' + +" Enable omni completion. +autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS +autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags +autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS +autocmd FileType python setlocal omnifunc=pythoncomplete#Complete +autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags +autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete +" Enable heavy omni completion. +if !exists('g:neocomplcache_omni_patterns') + let g:neocomplcache_omni_patterns = {} +endif +let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' diff --git a/vimrc b/vimrc index 311a141..a40a61d 100644 --- a/vimrc +++ b/vimrc @@ -51,7 +51,6 @@ set softtabstop=2 set tabstop=2 set expandtab set autoindent -set list listchars=tab:\ \ ,trail:· " Prevent 'Press ENTER..' on error messages set shortmess=atI @@ -66,9 +65,8 @@ set wildmode=list:longest set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing -"display tabs and trailing spaces -set list -set listchars=tab:\ \ ,extends:>,precedes:< +"display tabs and trailing spaces +set list listchars=tab:\ \ ,trail:· set formatoptions-=o "dont continue comments when pushing o/O @@ -122,4 +120,6 @@ set viminfo='100,f1 " prevent auto insert mode, which is helpful when using conque " term for running tests +" autocmd WinEnter * stopinsert +"autocmd WinEnter * NeoComplCacheEnable