set encoding=japan " ファイルの漢字コード自動判別のために必要。(要iconv) if has('iconv') set fileencodings& set fileencodings+=ucs-2le,ucs-2 let s:enc_euc = 'euc-jp' let s:enc_jis = 'iso-2022-jp' " iconvがJISX0213に対応しているかをチェック if iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb" let s:enc_euc = 'euc-jisx0213,euc-jp' let s:enc_jis = 'iso-2022-jp-3' endif " fileencodingsを構築 let &fileencodings = &fileencodings.','.s:enc_jis.',utf-8' if &encoding =~# '^euc-\%(jp\|jisx0213\)$' set fileencodings+=cp932 let &encoding = s:enc_euc else let &fileencodings = &fileencodings.','.s:enc_euc endif " 定数を処分 unlet s:enc_euc unlet s:enc_jis endif if has('keymap') && !exists('g:keymap_japanese_disable') if &keymap == '' " ローマ字仮名のkeymap silent! set keymap=japanese endif set iminsert=0 imsearch=0 endif if has('multi_byte_ime') || has('xim') " IME ON時のカーソルの色を設定(設定例:紫) highlight CursorIM guibg=Purple guifg=NONE " 挿入モード・検索モードでのデフォルトのIME状態設定 set iminsert=0 imsearch=0 if has('xim') && has('GUI_GTK') " XIMの入力開始キーを設定(s-spaceはShift+Spaceでkinput2+canna用設定) set imactivatekey=s-space endif " 挿入モードでのIME状態を記憶させない場合、次行のコメントを解除 "inoremap :set iminsert=0 endif set showcmd set incsearch set nocompatible set hlsearch set expandtab set ts=4 sw=4 sts=4 set clipboard+=unnamed set fo+=r set shortmess+=I set cindent set ignorecase set smartcase set autoindent set backspace=2 set wrapscan set showmatch set wildmenu set formatoptions+=mM set number set ruler set nolist set wrap set laststatus=2 set cmdheight=2 set title set shortmess+=I set nobackup syn on gui colorscheme midnight2 set gfn=Osaka−等幅:h12:cSHIFTJIS "set gfn=Courier_New:h12:cSHIFTJIS set columns=140 set lines=40 set linespace=3 set guioptions-=T set guioptions+=b winpos 36 23 set dir=c:\Program\ Files\vim if has("autocmd") autocmd BufNewFile,Bufread *.php,*.php3,*.php4 set keywordprg="help" endif " {{{ Automatic close char mapping inoremap { {}O inoremap [ [] inoremap ( () inoremap " "" inoremap ' '' " }}} Automatic close char mapping " {{{ Wrap visual selections with chars :vnoremap ( "zdi(z) :vnoremap { "zdi{z} :vnoremap [ "zdi[z] :vnoremap ' "zdi'z' :vnoremap " "zdi"z" " }}} Wrap visual selections with chars " {{{ Dictionary completion " The completion dictionary is provided by Rasmus: " http://lerdorf.com/funclist.txt set dictionary-=c:\\Program\ Files\\Vim\\funclist.txt dictionary+=c:\\Program\ Files\\Vim\\funclist.txt " Use the dictionary completion set complete-=k complete+=k " }}} Dictionary completion " {{{ Autocompletion using the TAB key " This function determines, wether we are on the start of the line text (then tab indents) or " if we want to try autocompletion function InsertTabWrapper() let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\" else return "\" endif endfunction " Remap the tab key to select action with InsertTabWrapper inoremap =InsertTabWrapper() " }}} Autocompletion using the TAB key " {{{ Mappings for autogeneration of PHP code " There are 2 versions available of the code templates, one for the case, that " the close character mapping is disabled and one for the case it is enabled. " {{{ With close char mapping activated (currently active) " require, require_once map! =req /** * * * * @since */require '; map! =roq /** * * * * @since */require_once '; " include, include_once map! =inc /** * * * * @since */include '; map! =ioc /** * * * * @since */include_once '; " define map! =def /** * * * * @since * @access public*/define (', ';?',i " class map! =cla /** * * * * @since */class {?/\*\*/ \* $i " public/private methods map! =puf /** * * * * @since * @access public* @param * @return void*/public function ({?/\*\*/ \* $i map! =prf /** * * * * @since * @access private* @param * @return void*/private function _ ({?/\*\*/ \* $i " public/private attributes map! =pua /** * * * @var * @since */public $ = ;?/\*\*/ \* $i map! =pra /** * * * @var * @since */private $_ = ;?/\*\*/ \* $i " for loop map! =for for ($i = 0; $i ; $i++ {/ ;i " foreach loop map! =foe foreach ($ as $ => $ {/\ asi " while loop map! =whi while ( {/ )i " switch statement map! =swi switch ($ {case ':break;default:break;/)i " alternative map! =if if ( { else {/)i " }}} With close char mapping activated (currently active) " {{{ With close char mapping de-activated (currently in-active) " require, require_once "map! =req /** * * * * @since */require '';hi "map! =roq /** * * * * @since */require_once '';hi " include, include_once "map! =inc /** * * * * @since */include '';hi "map! =ioc /** * * * * @since */include_once '';hi " define "map! =def /** * * * * @since * @access public*/define ('', '');?',i " class "map! =cla /** * * * * @since */class {}?/\*\*/ \* $i " public/private methods "map! =puf /** * * * * @since * @access public* @param * @return void*/public function (){}?/\*\*/ \* $i "map! =prf /** * * * * @since * @access private* @param * @return void*/private function _ (){}?/\*\*/ \* $i " public/private attributes "map! =pua /** * * * @var * @since */public $ = ;?/\*\*/ \* $i "map! =pra /** * * * @var * @since */private $_ = ;?/\*\*/ \* $i " for loop "map! =for for ($i = 0; $i ; $i++) {}/ ;i " foreach loop "map! =foe foreach ($ as $ => $) {} " while loop "map! =whi while ( ) {}/ )i " switch statement "map! =swi switch ($) {case '':break;default:break;}/)i " alternative "map! =if if () {} else {}/)i " }}} With close char mapping de-activated (currently in-active) " }}} Mappings for autogeneration of PHP code