eiji's watching list
-
[1879] AutoComplPop
-
[2150] css_color.vim
-
[23] EnhCommentify.vim
-
[1984] FuzzyFinder
-
[39] matchit.zip
-
[521] mru.vim
-
[2164] renamec.vim
-
[1601] Smooth Scroll
-
[1697] surround.vim
-
[1658] The NERD tree
-
[90] vcscommand.vim
-
[1234] YankRing.vim
-
[2981] ZenCoding.vim
.vimrc
"vi互換を無効に
set nocompatible
"ファイルタイプをオン
filetype plugin indent on
"ツールバーを非表示に
set guioptions-=T
set guioptions-=m
"行番号を表示
set number
"タブ幅
set tabstop=2
set softtabstop=2
set shiftwidth=2
set textwidth=0
"インデント
set autoindent
set smartindent
"長い行は折り返す
set wrap
"編集中のファイルを保存しなくても画面切り替えできるように
set hid
"バックアップファイルを作成しない
set nobackup
"スワップファイルを作成しない
set noswapfile
"改行コードの自動認識
set fileformats=unix,dos,mac
"ヤンクを*レジスタにも入るようにすることでクリップボードにも入る
set clipboard=unnamed
"検索の大文字小文字区別なく
set ignorecase
"インクリメンタルサーチ
set incsearch
"バックスペースはインデント等にも適用
set backspace=indent,eol,start
"カーソル行を強調
set cursorline
"ステータスラインを常に表示
set laststatus=2
"ファイルタイプ・文字コード・改行コードをステータスラインに表示
set statusline=%<[%n]%F\ %m%r%h%w%y%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P
"Exコマンドのキーバインドを入れ替えて;でコマンドラインモードに
noremap ; :
"noremap : ;
"表示行ごとに移動
nnoremap j gj
nnoremap k gk
"倫理行ごとに移動
nnoremap gj j
nnoremap gk k
"インサートモードでもjkhl移動
inoremap <C-J> <DOWN>
inoremap <C-K> <UP>
inoremap <C-H> <LEFT>
inoremap <C-L> <RIGHT>
"ノーマルモードでもエンターで改行
noremap <CR> o<ESC>
"括弧が入力されたときに自動的に閉じ括弧を入力する
inoremap [ []<LEFT>
inoremap ( ()<LEFT>
inoremap { {}<LEFT>
"inoremap " ""<LEFT>
"バッファ切り替えのキーマップ
"前のバッファ
map <F2> <ESC>:bp<CR>
"次のバッファ
map <F3> <ESC>:bn<CR>
"バッファ削除
map <F4> <ESC>:bw<CR>
"文字カウント
vnoremap <f11> :s/./&/g
"画面サイズを+/-キーで変更
map <kPlus> <C-W>+
map <kMinus> <C-W>-
"NERDのトグルをキーマップ
nnoremap <f12> :NERDTreeToggle<CR>
"EnhancedCommentiyで、ブロック単位でコメントアウト
let g:EnhCommentifyMultiPartBlocks = 'yes'
"matchit.vimで%を拡張
"対応するタグに移動できるようにする
:let b:match_words = '<:>,<tag>:</tag>'
"fuzzyfinder.vimの設定
"http://subtech.g.hatena.ne.jp/secondlife/20091203/1259817893
"http://tech.kayac.com/archive/vim-3-plugin.html
"nnoremap <unique> <silent> <C-S> :FufBuffer!<CR>
"nnoremap <unique> <silent> ef :FufFile!<CR>
"nnoremap <silent> eff :FufFile!<CR>
"nnoremap <silent> efm :FufMruFile!<CR>
nnoremap <unique> <silent> <space>fb :FufBuffer!<CR>
nnoremap <unique> <silent> <space>ff :FufFile!<CR>
nnoremap <unique> <silent> <space>fd :FufDir!<CR>
nnoremap <unique> <silent> <space>fm :FufMruFile!<CR>
nnoremap <unique> <silent> <Space>fc :FufRenewCache<CR>
autocmd FileType fuf nmap <C-c> <ESC>
let g:fuf_splitPathMatching = ' '
let g:fuf_patternSeparator = ' '
let g:fuf_modesDisable = ['mrucmd']
let g:fuf_mrufile_exclude = '\v\~$|\.bak$|\.swp|\.howm$'
let g:fuf_mrufile_maxItem = 10000
let g:fuf_enumeratingLimit = 20
"JavaScript辞書
set dictionary=$HOME/vimfiles/dict/javascript.dict
"HTML文字実体参照の変換を行うスクリプトstr2htmlentity.vim用
vmap <silent> sx :Str2HtmlEntity<cr>
vmap <silent> sr :Entity2HtmlString<cr>
"/{pattern}の入力中は「/」をタイプすると自動で「\/」が、
"?{pattern}の入力中は「?」をタイプすると自動で「\?」が 入力される
cnoremap <expr> / getcmdtype() == '/' ? '\/' : '/'
cnoremap <expr> ? getcmdtype() == '?' ? '\?' : '?'
" HTMLとかでドキュメントルートからの絶対パスのファイルを開く(gfみたいな感じで)
" 絶対パスじゃなかったら(/で始まってなかったら)gfと同じ
" ドキュメントルートのディレクトリは配列で複数指定できる。
"http://webtech-walker.com/archive/2009/10/02230656.html
let s:root_dirs = [$HOME.'/dev/site/localhost/test']
function! GotoAbsFile()
let filename = expand('<cfile>')
let filepath = filename
if (match(filename, '^/') != -1)
for dir in s:root_dirs
if match(expand("%:p:h"), dir) != -1 && isdirectory(dir) == 1
let filepath = dir . filename
break
endif
endfor
endif
if filereadable(filepath)
execute 'edit ' . filepath
else
echohl ErrorMsg
echo 'no such file ' . filename
echohl None
endif
endfunction
nnoremap gaf :<C-u>call GotoAbsFile()<CR>
"開いているファイルのディレクトリをカレントディレクトリに
augroup BufferAu
autocmd!
" カレントディレクトリを自動的に移動
autocmd BufNewFile,BufRead,BufEnter * if isdirectory(expand("%:p:h")) && bufname("%") !~ "NERD_tree" | cd %:p:h | endif
augroup END
"カレントディレクトリのキーマッピング via:http://vim-users.jp/2009/09/hack69/
"CDというコマンドを定義し、<Space>cdに割り当てています。
"コマンドが引数なしで呼び出されたときは、現在開いているファイルと同じディレクトリに移動し、そうでない場合は引数のディレクトリに移動します。
":CD!として呼び出された場合、移動先のカレントディレクトリを表示し、どこに移動したのかを分かり易くしています。
command! -nargs=? -complete=dir -bang CD call s:ChangeCurrentDir('<args>', '<bang>')
function! s:ChangeCurrentDir(directory, bang)
if a:directory == ''
lcd %:p:h
else
execute 'lcd' . a:directory
endif
if a:bang == ''
pwd
endif
endfunction
" Change current directory.
nnoremap <silent> <Space>cd :<C-u>CD<CR>
" 文字コードの自動認識
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
"拡張子htmlの際に読み込むテンプレートの設定
augroup SkeletonAu
autocmd!
autocmd BufNewFile *.html 0r $HOME/vimfiles/templates/skel.html
augroup END
