Vimいじってみた
三日ぶりにEmacsいじってると重くて仕方なかった。
環境をつくり直すよりかはどうせvimキーバインドに慣れてることだしVimで環境を作ってみるのも悪くないかなーと思った次第
というか Unite を使ってみたかったのもある
プラギン
- unite
- vimshell
- neocomplecache
- vimfiler
- vimproc
- hatena-edit
Shougoさんすごい。
.vimrc
set runtimepath+=/Users/mizchi/.vim set clipboard=unnamed "share clipboard with other applications set number set hidden set formatoptions=lmoq set vb t_vb= set ignorecase set smartcase set tabstop=4 set expandtab set wildmenu map ,s :mapc<CR>:nmapc<CR>:imapc<CR>:so .vimrc<CR> imap <C-g> <esc> vmap <C-g> <esc> nnoremap <silent> <C-r> :<C-u>Unite file_mru<CR> nnoremap <silent> <C-n> :<C-u>Unite buffer <CR> nnoremap <silent> ,d :<C-u>Unite file<CR> autocmd FileType unite call s:unite_my_settings() function! s:unite_my_settings() " Overwrite settings. imap <buffer> jj <Plug>(unite_insert_leave) imap <buffer> <ESC> <ESC><ESC> nnoremap <buffer> t G startinsert endfunction let g:vimfiler_as_default_explorer = 1 " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Use camel case completion. let g:neocomplcache_enable_camel_case_completion = 1 " Use underbar completion. let g:neocomplcache_enable_underbar_completion = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' " Define dictionary. let g:neocomplcache_dictionary_filetype_lists = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } " Define keyword. if !exists('g:neocomplcache_keyword_patterns') let g:neocomplcache_keyword_patterns = {} endif let g:neocomplcache_keyword_patterns['default'] = '\h\w*' " Plugin key-mappings. imap <C-k> <Plug>(neocomplcache_snippets_expand) smap <C-k> <Plug>(neocomplcache_snippets_expand) inoremap <expr><C-g> neocomplcache#undo_completion() inoremap <expr><C-l> neocomplcache#complete_common_string() " SuperTab like snippets behavior. "imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>" " Recommended key-mappings. " <CR>: close popup and save indent. inoremap <expr><CR> neocomplcache#smart_close_popup() . (&indentexpr != '' ? "\<C-f>\<CR>X\<BS>":"\<CR>") " <TAB>: completion. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" " <C-h>, <BS>: close popup and delete backword char. inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>" inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>" inoremap <expr><C-y> neocomplcache#close_popup() inoremap <expr><C-e> neocomplcache#cancel_popup() " AutoComplPop like behavior. "let g:neocomplcache_enable_auto_select = 1 " 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 " 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*::' "autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete " === vimshell === let g:vimshell_smart_case = 1 let g:vimshell_ignore_case = 1 let g:vimshell_prompt = '$: ' let $PATH .= ':/opt/local/bin:/usr/local/bin:/opt/local/sbin:~/bin' " current directory を変更 au BufEnter * execute ":lcd " . expand("%:p:h") set runtimepath+=$HOME/.vim/hatena let g:hatena_user='mizchi'