set nocompatible " must be first! syntax on colorscheme pyte " -------------- " extend color " -------------- highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=white match ZenkakuSpace / / " -------------- " 日?語の設定 " -------------- set termencoding=utf-8 set encoding=japan set fileencodings=utf-8,iso-2022-jp,cp932,euc-jp set fenc=utf-8 set enc=utf-8 " -------------- " search " -------------- set ignorecase set smartcase set incsearch set hlsearch set wrapscan " -------------- " format " -------------- set tabstop=4 set shiftwidth=4 set shiftround set autoindent set expandtab set listchars=tab:>- set list set ambiwidth=double " -------------- " key bind " -------------- "map = all "vmap = visual mode "nmap = normal mode "cnoremap = command mode "imap = insert mode set backspace=indent,eol,start nnoremap j gj nnoremap k gk "map :bn "map :bp nnoremap bn :bn nnoremap bp :bp nnoremap bd :bd nnoremap wv v nnoremap ws s nnoremap wh h nnoremap wj j nnoremap wk k nnoremap wl l nnoremap te :tabe nnoremap tn :tabn nnoremap tp :tabp vnoremap * y/0 " -------------- " auto save " -------------- "autocmd CursorHold * update set updatetime=500 " -------------- " buffer " -------------- set hidden set history=50 set number set laststatus=2 " -------------- " other " -------------- set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P set showmatch set showcmd set nobackup set ruler set autoread " -------------- " call function " -------------- filetype plugin indent on autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete " -------------- " for perl " -------------- autocmd FileType perl set makeprg=perl\ -c\ %\ $* autocmd FileType perl set errorformat=%f:%l:%m autocmd FileType perl set autowrite map $1 :s/^/# / map $2 :s/^# // map perl O#!/usr/bin/perliuse strict;iuse warnings; " -------------- " short cut " -------------- " "inoremap date =strftime("%Y/%m/%d %H:%M:%S") ""inoremap { {} ""inoremap [ [] ""inoremap ( () ""inoremap " "" ""inoremap ' '' iabbrev ,# # ========================================================================= iabbrev ## # ------------------------------------------------------------------------- " ------------------------------------------------------------------------- " auto cd " ref. http://nanasi.jp/articles/vim/cd_vim.html " " ------------------------------------------------------------------------- au BufEnter * execute ":lcd " . expand("%:p:h") "---------------------------------------- "文字コードの自動認識 "---------------------------------------- let &termencoding = &encoding set encoding=utf-8 " 文字コードの自動認識 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 if has('win32') let &fileencoding='cp932' endif endif endfunction autocmd BufReadPost * call AU_ReCheck_FENC() endif " 改行コードの自動認識 set fileformats=unix,dos,mac " □や○の文字があってもカーソル位置がずれないようにする。 if exists('&ambiwidth') set ambiwidth=double endif "---------------------------------------- "メッセージの日本語化 "---------------------------------------- if has('unix')&&has('gui_running') let $LANG='ja' endif