Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "----------------------------------------------------
- " 基本的な設定
- "----------------------------------------------------
- " viとの互換性をとらない(vimの独自拡張機能を使う為)
- set nocompatible
- " 改行コードの自動認識
- set fileformats=unix,dos,mac
- " ビープ音を鳴らさない
- set vb t_vb=
- "----------------------------------------------------
- " バックアップ関係
- "----------------------------------------------------
- " バックアップをとらない
- set nobackup
- " ファイルの上書きの前にバックアップを作る
- " (ただし、backup がオンでない限り、バックアップは上書きに成功した後削除される)
- "set writebackup
- " バックアップファイルを作るディレクトリ
- "set backupdir=$VIM/backup
- " スワップファイルを作るディレクトリ
- "set directory=$VIM/swap
- "----------------------------------------------------
- " 検索関係
- "----------------------------------------------------
- " コマンド、検索パターンを100個まで履歴に残す
- set history=100
- " 検索の時に大文字小文字を区別しない
- set ignorecase
- " 検索の時に大文字が含まれている場合は区別して検索する
- set smartcase
- " 最後まで検索したら先頭に戻る
- set wrapscan
- " インクリメンタルサーチを使う
- set incsearch
- "----------------------------------------------------
- " 表示関係
- "----------------------------------------------------
- " タイトルをウインドウ枠に表示する
- set title
- " 行番号を表示する
- set number
- " ルーラーを表示
- "set ruler
- " タブ文字を CTRL-I で表示し、行末に $ で表示する
- set nolist
- " 入力中のコマンドをステータスに表示する
- set showcmd
- " 常にステータス行を表示 (詳細は:he laststatus)
- set laststatus=2
- " コマンドラインの高さ (Windows用gvim使用時はgvimrcを編集すること)
- set cmdheight=2
- " 括弧入力時の対応する括弧を表示
- set showmatch
- " 対応する括弧の表示時間を2にする
- set matchtime=2
- " シンタックスハイライトを有効にする
- syntax on
- " 検索結果文字列のハイライトを有効にする
- set hlsearch
- " コメント文の色を変更
- highlight Comment ctermfg=DarkCyan
- " 画面を黒地に白にする
- colorscheme evening " (Windows用gvim使用時はgvimrcを編集すること)
- " コマンドライン補完を拡張モードにする
- set wildmenu
- " 入力されているテキストの最大幅
- " (行がそれより長くなると、この幅を超えないように空白の後で改行される)を無効にする
- set textwidth=0
- " ウィンドウの幅より長い行は折り返して、次の行に続けて表示する
- set wrap
- " 全角スペースの表示
- highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=darkgray
- match ZenkakuSpace / /
- " ステータスラインに表示する情報の指定
- set statusline=%n\:%y%F\ \|%{(&fenc!=''?&fenc:&enc).'\|'.&ff.'\|'}%m%r%=<%l/%L:%p%%>
- " ステータスラインの色
- highlight StatusLine term=NONE cterm=NONE ctermfg=black ctermbg=white
- "----------------------------------------------------
- " 編集に関する設定:
- "----------------------------------------------------
- " バックスペースキーで削除できるものを指定
- " indent : 行頭の空白
- " eol : 改行
- " start : 挿入モード開始位置より手前の文字
- set backspace=indent,eol,start
- " オートインデントを有効にする
- set autoindent
- " タブが対応する空白の数
- set tabstop=4
- " タブやバックスペースの使用等の編集操作をするときに、タブが対応する空白の数
- set softtabstop=4
- " インデントの各段階に使われる空白の数
- set shiftwidth=4
- " タブを挿入するとき、代わりに空白を使う
- set expandtab
- " テキスト挿入中の自動折り返しを日本語に対応させる
- set formatoptions+=mM
- "----------------------------------------------------
- " 国際化関係
- "----------------------------------------------------
- " 文字コードの設定
- " fileencodingsの設定ではencodingの値を一番最後に記述する
- set encoding=utf-8
- set termencoding=utf-8
- set fileencoding=utf-8
- set fileencodings=ucs-bom,euc-jp,cp932,iso-2022-jp
- set fileencodings+=,ucs-2le,ucs-2,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
- endif
- endfunction
- autocmd BufReadPost * call AU_ReCheck_FENC()
- endif
- " 改行コードの自動認識
- set fileformats=unix,dos,mac
- " □とか○の文字があってもカーソル位置がずれないようにする
- if exists('&ambiwidth')
- set ambiwidth=double
- endif
- "----------------------------------------------------
- " オートコマンド
- "----------------------------------------------------
- if has("autocmd")
- " ファイルタイプ別インデント、プラグインを有効にする
- filetype plugin indent on
- " カーソル位置を記憶する
- autocmd BufReadPost *
- \ if line("'\"") > 0 && line("'\"") <= line("$") |
- \ exe "normal g`\"" |
- \ endif
- endif
- "----------------------------------------------------
- " バイナリモード編集
- "----------------------------------------------------
- "バイナリ編集(xxd)モード(vim -b での起動、もしくは *.bin ファイルを開くと発動します)
- augroup BinaryXXD
- autocmd!
- autocmd BufReadPre *.bin let &binary =1
- autocmd BufReadPost * if &binary | silent %!xxd -g 1
- autocmd BufReadPost * set ft=xxd | endif
- autocmd BufWritePre * if &binary | %!xxd -r | endif
- autocmd BufWritePost * if &binary | silent %!xxd -g 1
- autocmd BufWritePost * set nomod | endif
- augroup END
- "----------------------------------------------------
- " プラグイン
- "----------------------------------------------------
- " プラグインディレクトリ
- let $plugins='$VIM\plugins'
- " QuickBuf
- source $plugins\qbuf.vim
- "ソースをコメントアウト ←→ コメントアウト解除
- source $plugins\commentout.vim
- "----------------------------------------------------
- " その他
- "----------------------------------------------------
- " バッファを切替えてもundoの効力を失わない
- set hidden
- " 起動時のメッセージを表示しない
- set shortmess+=I
Add Comment
Please, Sign In to add comment