|
||
また.vimrc張っときます。
Set
ction
" auto QuickFix {{{ " url : http://vimwiki.net/?tips%2F66 " move MakeEasy " }}} " ruby {{{ "preview interpreter's output(Tip #1244) function! Ruby_eval_vsplit() range if &filetype == "ruby" let src = tempname() let dst = "RubyOutput" " put current buffer's content in a temp file silent execute ": " . a:firstline . "," . a:lastline . "w " . src " open the preview window silent execute ":pedit! " . dst " change to preview window wincmd P " set options setlocal buftype=nofile setlocal noswapfile setlocal syntax=none setlocal bufhidden=delete " replace current buffer with ruby's output silent execute ":%! ruby " . src " change back to the source buffer wincmd p endif endfunction "<F10>でバッファのRubyスクリプトを実行し、結果をプレビュー表示 vmap <silent> <F10> :call Ruby_eval_vsplit()<CR> nmap <silent> <F10> mzggVG<F10>`z map <silent> <S-F10> :pc<CR> " }}} au BufWritePost memo.txt helptags . " }}} " jp {{{ " 文字コードの自動認識 if &encoding !=# 'utf-8' set encoding=japan set fileencoding=japan endif if has('iconv') let s:enc_euc = 'euc-jp' let s:enc_jis = 'iso-2022-jp' " iconvがeucJP-msに対応しているかをチェック if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb" let s:enc_euc = 'eucjp-ms' let s:enc_jis = 'iso-2022-jp-3' " iconvがJISX0213に対応しているかをチェック elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb" let s:enc_euc = 'euc-jisx0213' let s:enc_jis = 'iso-2022-jp-3' endif " fileencodingsを構築 if &encoding ==# 'utf-8' let s:fileencodings_default = &fileencodings let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932' let &fileencodings = &fileencodings .','. s:fileencodings_default unlet s:fileencodings_default else let &fileencodings = &fileencodings .','. s:enc_jis set fileencodings+=utf-8,ucs-2le,ucs-2 if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$' set fileencodings+=cp932 set fileencodings-=euc-jp set fileencodings-=euc-jisx0213 set fileencodings-=eucjp-ms let &encoding = s:enc_euc let &fileencoding = s:enc_euc else let &fileencodings = &fileencodings .','. s:enc_euc endif endif " 定数を処分 unlet s:enc_euc unlet s:enc_jis endif " 日本語を含まない場合は fileencoding に encoding を使うようにする if has('autocmd') function! AU_ReCheck_FENC() if &fileencoding =~# 'iso-2022-jp' && search("[^\x01-\x7e]", 'n') == 0 let &fileencoding=&encoding endif endfunction autocmd BufReadPost * call AU_ReCheck_FENC() endif " 改行コードの自動認識 set fileformats=unix,dos,mac " □とか○の文字があってもカーソル位置がずれないようにする if exists('&ambiwidth') set ambiwidth=double endif " :IminsertOff/On " command! -nargs=0 IminsertOff inoremap <buffer> <silent> <ESC> <ESC>:set iminsert=0<CR> " command! -nargs=0 IminsertOn iunmap <buffer> <ESC> " runtime macros/editexisting.vim " }}}
" key bindings {{{ noremap ,, , " help : key-notation set backspace=indent,eol,start set winaltkeys=no set timeoutlen=100000 " 関数を範囲選択 vmap \f <ESC>][mz[[V'z " noremap <silent> <leader> :set timeoutlen=3000<CR> " inoremap <silent> <ESC> <ESC>:set timeoutlen=10<CR> noremap <Del> "_ noremap <Leader>te :tabe<cr> noremap <Leader>tc :tabc<cr> noremap <Leader>tn :tabn<cr> noremap <Leader>tp :tabp<cr> noremap <C-Tab> :bn<cr> noremap <C-S-Tab> :bp<cr> noremap <Leader><tab> :bn<cr> map <silent> <F4> :w<CR>:call ReloadFirefox()<CR> map <silent> <F5> :w<CR>:make<CR> map <silent> <F6> :w<CR>:make debug<CR> au! User Rails map <buffer> <silent> <F5> :w<CR>:call ReloadFirefox()<CR> " noremap o o<ESC> " noremap O O<ESC> " smart insert改 http://d.hatena.ne.jp/spiritloose/20061113/1163401194 if has('gui_running') nmap ( /(<CR>:noh<CR> nmap ) /)<CR>:noh<CR> nmap <M-9> ysa()a nmap <M-0> ds) inoremap <M-{> {}<Left> inoremap <M-[> []<Left> inoremap <M-(> ()<Left> inoremap <M-"> ""<Left> inoremap <M-'> ''<Left> inoremap <M-<> <><Left> "vnoremap { "zdi{<C-R>z}<ESC> "vnoremap [ "zdi[<C-R>z]<ESC> "vnoremap ( "zdi(<C-R>z)<ESC> "vnoremap " "zdi"<C-R>z"<ESC> "vnoremap ' "zdi'<C-R>z'<ESC> nnoremap <M-;> A;<ESC> inoremap <M-;> <ESC>A;<ESC> inoremap <M-}> <ESC>A<Space>{}<Left><CR><ESC>O nnoremap <M-}> A<Space>{}<Left><CR><ESC>O aug CloseBlock au! au FileType ruby,eruby imap <M-}> <ESC>oend<ESC>O au FileType ruby,eruby nmap <M-}> oend<ESC>O au FileType ruby,eruby imap <M-#> #{}<Left> aug END noremap <M-s> :%S//g<Left><Left> inoremap <M-p> <C-p> inoremap <M-n> <C-n> inoremap <M-l> <C-X><C-L> inoremap <M-o> <C-X><C-O> inoremap <M-k> <C-X><C-K> inoremap <M-u> <C-X><C-U> endif " for screen function! ScreenSpiritOpen(cmd) call system("screen -X eval split focus 'screen " . a:cmd ."' focus") endfunction function! ScreenEval(str) let s = substitute(a:str, "[\n]*$", "\n\n", "") " 最後が改行 * 2で終わるようにする。 call writefile(split(s, "\n"), "/tmp/vim-screen", "b") if has('gui_running') call system("screen -X eval 'readreg p /tmp/vim-screen' 'paste p'") else call system("screen -X eval focus 'readreg p /tmp/vim-screen' 'paste p' focus") endif endfunction nmap ,e :call ScreenEval(getline('.'))<CR> vmap ,e "zy:call ScreenEval(@z)<CR> command! -nargs=1 Screen call ScreenSpiritOpen("<args>") " smooth-smooth scroll map <C-U> <C-Y>2<C-Y>2<C-Y>2<C-Y>2<C-Y><C-Y> map <C-D> <C-E>2<C-E>2<C-E>2<C-E>2<C-E><C-E> " emacs like? kyes if has('gui_running') cnoremap <M-a> <C-A> cnoremap <M-b> <C-B> cnoremap <M-d> <C-D> cnoremap <M-e> <C-E> cnoremap <M-f> <C-F> cnoremap <M-n> <C-N> cnoremap <M-p> <C-P> cnoremap <M-b> <S-Left> cnoremap <M-f> <S-Right> endif cnoremap <C-A> <Home> cnoremap <C-B> <Left> cnoremap <C-D> <Del> cnoremap <C-E> <End> cnoremap <C-F> <Right> cnoremap <C-N> <Down> cnoremap <C-P> <Up> " }}} au VimEnter * Scratch | set ft=vim | exe "normal i\" = Scratch ===========================================\n\n" | b 1
あれ?うまく貼れてなかった。