Skip to content

Instantly share code, notes, and snippets.

@qickstarter
Created August 30, 2012 08:56
Show Gist options
  • Save qickstarter/3524479 to your computer and use it in GitHub Desktop.
Save qickstarter/3524479 to your computer and use it in GitHub Desktop.
"----------------------------------------
"補完・履歴 Complete "{{{
set wildmenu " コマンド補完を強化
set wildchar=<tab> " コマンド補完を開始するキー
set wildmode=longest:full,full
set history=1000 " コマンド・検索パターンの履歴数
set complete+=k,U,kspell,t,d " 補完を充実
set completeopt=menu,menuone,preview
set infercase
" FileType毎のOmni補完を設定
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 php setlocal omnifunc=phpcomplete#CompletePHP
autocmd FileType c setlocal omnifunc=ccomplete#Complete
autocmd FileType ruby,eruby,yml,ruby.rspec setlocal omnifunc=
autocmd FileType ruby,eruby,yml,ruby.rspec setlocal completefunc+=RSenseCompleteFunction
autocmd FileType ruby,eruby,ruby.rpec setlocal dict+=~/.vim/dict/ruby.dict
autocmd FileType ruby.rpec setlocal dict+=~/.vim/dict/rspec.dict
"----------------------------------------
" neocomplcache
" default config"{{{
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
let g:neocomplcache_max_list = 300
" let g:neocomplcache_max_keyword_width = 40
" let g:neocomplcache_max_menu_width = 19
" let g:neocomplcache_auto_completion_start_length = 2
" let g:neocomplcache_manual_completion_start_length = 2
" let g:neocomplcache_min_keyword_length = 2
" let g:neocomplcache_min_syntax_length = 4
" let g:neocomplcache_cursor_hold_i_time = 300
" let g:neocomplcache_enable_insert_char_pre = 0
" let g:neocomplcache_enable_auto_select = 1
" let g:neocomplcache_enable_auto_delimiter = 0
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_ctags_program = "jctags"
" default config snippet
let g:neocomplcache_snippets_dir=expand('~/.vim/snippet')
"}}}
" ファイルタイプ毎の辞書ファイルの場所"{{{
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'java' : $HOME.'/.vim/dict/java.dict',
\ 'ruby' : $HOME.'/.vim/dict/ruby.dict',
\ 'eruby' : $HOME.'/.vim/dict/ruby.dict',
\ 'javascript' : $HOME.'/.vim/dict/javascript.dict',
\ 'lua' : $HOME.'/.vim/dict/lua.dict',
\ 'ocaml' : $HOME.'/.vim/dict/ocaml.dict',
\ 'perl' : $HOME.'/.vim/dict/perl.dict',
\ 'c' : $HOME.'/.vim/dict/c.dict',
\ 'php' : $HOME.'/.vim/dict/php.dict',
\ 'scheme' : $HOME.'/.vim/dict/scheme.dict',
\ 'vim' : $HOME.'/.vim/dict/vim.dict',
\ 'timobile' : $HOME.'/.vim/dict/timobile.dict',
\ }
"}}}
"
let g:neocomplcache_dictionary_patterns = {
\'php': expand('~/.vim/dict/zendphp.dict'),
\'javascript': expand('~/.vim/dict/timobile.dict'),
\}
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" rubyの設定
if !exists('g:neocomplcache_omni_functions')
let g:neocomplcache_omni_functions = {}
endif
let g:neocomplcache_omni_functions.ruby = 'RSenseCompleteFunction'
" 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*::'
let g:neocomplcache_omni_patterns['ruby.rspec'] = '[^. *\t]\.\w*\|\h\w*::'
" let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*'
" let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
" let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*'
" let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::'
" let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
" keymap"{{{
" Plugin key-mappings.
imap <C-F> <Plug>(neocomplcache_snippets_expand)
smap <C-F> <Plug>(neocomplcache_snippets_expand)
imap <C-U> <Esc>:Unite snippet<CR>
inoremap <expr><C-g> neocomplcache#undo_completion()
" inoremap <expr><C-L> neocomplcache#complete_common_string()
if has('conceal')
set conceallevel=2 concealcursor=i
endif
imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ?
\"\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" snippetの編集
nmap <Space>e :<C-U>NeoComplCacheEditSnippets<CR>
au BufRead,BufNewFile *.snip set filetype=snippet
if !exists('g:neocomplcache_auto_completion_start_length')
inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <silent><expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
" inoremap <expr><C-y> neocomplcache#close_popup()
" inoremap <expr><C-e> neocomplcache#cancel_popup()
inoremap <silent><CR> <C-R>=neocomplcache#smart_close_popup()<CR><CR>
endif
"}}}
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment