Windowsインストール(6)
Vim
インストール
- ダウンロード
- "Runtime files"(vim72rt.zip)をダウンロード、展開
- "Win32 console executable"(vim72w32.zip)をダウンロード、展開
- すべて同じ"C:\vim"ディレクトリに混ぜ入れ
- "C:\vim\vim32\install.bat"をクリックして起動
- 質問に対して"d[Enter]"を入力
- PATHに"C:\vim\vim72"を追加
- "C:\vim\_vimrc"を編集
" Command -- syntax on filetype on set showcmd set laststatus=2 set statusline=%<%f\ %h%r%w%=\ %M\ %l,%v\ %{'['.(&ft!=''?&ft:'any').','.(&fenc!=''?&fenc:&enc).','.&ff.']'}[%n] " Edit -- set autoindent set backspace=indent,eol,start set cinwords=if,unless,else,elsif,while,do,for,switch set errorbells set incsearch set list set listchars=tab:>\ ,trail:- set scrolljump=20 set tabstop=4 set whichwrap=b,s,h,l,<,>,[,] nmap <silent> <F4> <C-W><C-W> nmap <silent> <C-Up> <C-W>j<C-W>_ nmap <silent> <C-Down> <C-W>k<C-W>_ nmap <silent> <C-Right> 4<C-W>+ nmap <silent> <C-Left> 4<C-W>- " File -- set autoread set autowrite set browsedir=buffer set fileencodings=utf-8,euc-jp,cp932 set fileformats=unix nmap <silent> <F2> :Sexplore<CR> " Encoding -- set encoding=utf-8 set termencoding=utf-8 " Make -- augroup make autocmd! make autocmd FileType java :compiler javac autocmd FileType perl :compiler perl autocmd FileType php :compiler php autocmd FileType python :compiler ptyhon autocmd FileType ruby :compiler ruby augroup END " thanks: http://blog.blueblack.net/item_150 nmap <silent> <F10> :w<CR>:make %<CR>:cw<CR>:cfirst<CR>zz nmap <silent> <S-F10> :ccl<CR> " Execute -- " thanks: http://blog.blueblack.net/item_150 function LL_execute(runtime, first, last) let src = tempname() let dst = tempname() execute ": " . a:first . "," . a:last . "w " . src execute ":silent ! " . a:runtime . " " . src . " > " . dst . " 2>&1 " execute ":pedit! " . dst endfunction let s:interpreter = { \"perl": [function("LL_execute"), "perl" ], \"php": [function("LL_execute"), "php" ], \"python": [function("LL_execute"), "python"], \"ruby": [function("LL_execute"), "ruby" ] \} function! Cmd_execute() range if empty(&filetype) return endif let cmd = get(s:interpreter, &filetype) if empty(cmd) return endif call call(cmd[0], [cmd[1], a:firstline, a:lastline]) endfunction vmap <silent> <F9> :call Cmd_execute()<CR> nmap <silent> <F9> mzggVG<F9>`z nmap <silent> <S-F9> :pclose<CR> " Full Width Space -- " thanks: http://d.hatena.ne.jp/potappo2/20061107/1162862536 function! JpSpace_highlight() syntax clear syntax match JpSpace " " display containedin=ALL highlight JpSpace term=underline ctermbg=1 endfunction augroup invisible autocmd! invisible autocmd BufNew,BufNewFile,BufRead * call JpSpace_highlight() augroup END " Remove trailing spaces -- function! Remove_trailing_spaces() normal mz silent %s/\s*$// normal `z endfunction augroup trailing autocmd! trailing autocmd BufWritePre * call Remove_trailing_spaces() augroup END " Last edit line -- function! Last_edit_line() if line("'\"") > 0 && line("'\"") <= line("$") normal g'" endif endfunction augroup lasteditline autocmd! lasteditline autocmd BufReadPost * call Last_edit_line() augroup END " Tlist -- let Tlist_Show_One_File = 1 let Tlist_Exit_OnlyWindow = 1 " for Windows -- map <silent> <S-Up> <C-Up> map <silent> <S-Down> <C-Down> map <silent> <S-Right> <C-Right> map <silent> <S-Left> <C-Left> set encoding=cp932 set termencoding=cp932 set fileencodings=utf-8,cp932,euc-jp,utf-16 set fileformats=dos,unix " for Unix -- "map <silent> <Esc>[24~ <S-F2> "map <silent> <Esc>[33~ <S-F9> "map <silent> <Esc>[34~ <S-F10> "map <silent> <Esc>[A <C-Up> "map <silent> <Esc>[B <C-Down> "map <silent> <Esc>[C <C-Right> "map <silent> <Esc>[D <C-Left>
- "C:\vim\.vimrc"にリネーム
> rename "C:\vim\_vimrc" "C:\vim\.vimrc"
スタートメニューの調整
ハードリンク
> mkdir "%USERPROFILE%\My Documents\etc\vim" > fsutil hardlink create "%USERPROFILE%\My Documents\etc\vim\.vimrc" "C:\vim\.vimrc" > fsutil hardlink create "C:\vim\vim72\vi.exe" "C:\vim\vim72\vim.exe"
プラグインtaglist.vim
- taglist.vim - Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc) : vim online
- ctags日本語対応版
- taglistをダウンロード、展開
- 中身を"C:\vim\vimfiles"へコピー
- ctagsをダウンロード、展開
- 中身を"C:\usr\bin"へコピー
初期化
> cd "C:\vim\vimfiles\doc" > vim :helptags .
起動
:Tlist
Msys Vim
ダウンロードへ直接リンクです。
- ダウンロードしたのち、7-Zipで展開
- "vim-7.2-1-msys-1.0.11-bin"以下を"C:\msys\1.0"にコピー
- "C:\msys\1.0\vim"にリネーム
- "$HOME/.profile"("C:\msys\1.0\home\ユーザ名\.profile")に以下を追加
export PATH="/vim/bin:$PATH"
設定
"$HOME/.profile"("C:\msys\1.0\home\ユーザ名\.profile")に追加します。
export PATH="/vim/bin:$PATH" export VIMRUNTIME="/vim/share/vim/vim72" alias vi=vim
"$HOME/.vimrc"("C:\msys\1.0\home\ユーザ名\.vimrc")を作ります。
set runtimepath+=/c/vim/vimfiles/ source /c/vim/.vimrc
※fencの設定が無いかもしれません(元々考えられてないかも)。