Create a gist now

Instantly share code, notes, and snippets.

@kazuph /vimrc
Last active Dec 23, 2015

What would you like to do?
vimrc_neo
" ___ ___ ___ ___
" |\__\ /\ \ /\ \ /\ \
" | | | / \ \ / \ \ / \ \
" | | | / /\ \ \ / /\ \ \ / /\ \ \
" | |__|__ / \~\ \ \ / \~\ \ \ / / \ \ \
" / \__\ / /\ \ \ \__\ / /\ \ \ \__\ / /__/ \ \__\
" / /~~/~ \/__\ \/ / / \/__\ \/ / / \ \ \ \/__/
" / / / \ / / \ / / \ \ \
" \/__/ / / / \/__/ \ \ \
" / / / \ \__\
" \/__/ \/__/
" Vim実践入門 ~Perl編~
" YAPC::ASIA 2013 9/20 at 慶応大学
"
set nocompatible
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
" NeoBundleをNeoBundleで管理したい
NeoBundleFetch 'Shougo/neobundle.vim'
" 加速されたjk
NeoBundle 'rhysd/accelerated-jk'
let g:accelerated_jk_acceleration_table = [10,5,3]
nmap j <Plug>(accelerated_jk_gj)
nmap k <Plug>(accelerated_jk_gk)
" 賢いf
NeoBundle 'rhysd/clever-f.vim'
" 曖昧な文字からファイルを検索
NeoBundle 'kien/ctrlp.vim'
" 様々な言語をvimから実行
NeoBundle 'thinca/vim-quickrun'
" 様々な言語を保存時にシンタックスチェック
NeoBundle 'scrooloose/syntastic'
" neocomで非同期処理するときに必要
NeoBundle 'Shougo/vimproc'
" Vimで補完を簡単に
NeoBundle 'Shougo/neocomplete.vim'
" スニペット補完する
NeoBundle 'Shougo/neosnippet.vim'
" snippetファイルがまとまっているもの
NeoBundle 'honza/vim-snippets'
" まとめ http://d.hatena.ne.jp/osyo-manga/20130717/1374069987
NeoBundle 'kana/vim-textobj-user'
" af, if
NeoBundle 'kana/vim-textobj-function'
NeoBundle 'thinca/vim-textobj-function-perl'
" 正規表現をテキストオブジェクトとして扱う
NeoBundle 'deris/vim-textobj-enclosedsyntax'
NeoBundle 'vimtaku/vim-textobj-sigil'
" perlなブラグイン達
NeoBundle "c9s/perlomni.vim"
NeoBundle "mattn/perlvalidate-vim.git"
NeoBundle "vim-perl/vim-perl"
" ドキュメントを引く
NeoBundle 'thinca/vim-ref'
" 入力を簡単にする
NeoBundle "smartchr"
inoremap <expr> , smartchr#one_of(', ', ', ')
autocmd FileType perl inoremap <buffer> <expr> . smartchr#loop(' . ', '->', '.')
autocmd FileType perl inoremap <buffer> <expr> = smartchr#loop(' = ', ' => ', '=')
NeoBundle 'kana/vim-operator-user.git'
NeoBundle 'tyru/operator-camelize.vim'
nmap C <Plug>(operator-camelize-toggle)
filetype plugin indent on
syntax on
" 未インストールなプラグインを探してくれる
NeoBundleCheck
" neocomplete.vim {{{
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplete#smart_close_popup() . "\<CR>"
" For no inserting <CR> key.
"return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"
" For cursor moving in insert mode(Not recommended)
"inoremap <expr><Left> neocomplete#close_popup() . "\<Left>"
"inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"
"inoremap <expr><Up> neocomplete#close_popup() . "\<Up>"
"inoremap <expr><Down> neocomplete#close_popup() . "\<Down>"
" Or set this.
"let g:neocomplete#enable_cursor_hold_i = 1
" Or set this.
"let g:neocomplete#enable_insert_char_pre = 1
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" 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:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
"}}}
" neosnippet.vim {{{
" Plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif
" Enable snipMate compatibility feature.
let g:neosnippet#enable_snipmate_compatibility = 1
" Tell Neosnippet about the other snippets
let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets'
" }}}
" for perl {{{
nnoremap ,pt <Esc>:%! perltidy -se<CR>
vnoremap ,pt <Esc>:'<,'>! perltidy -se<CR>
" perlなファイルのシンタックスハイライト
augroup filetypedetect
au BufNewFile,BufRead *.psgi setf perl
au BufNewFile,BufRead *.t setf perl
au BufNewFile,BufRead *.tt setf tt2html
au BufNewFile,BufRead *.tt2 setf tt2html
au BufNewFile,BufRead cpanfile setf perl
augroup END
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment