カレンダー
| 10 | 2025/11 | 12 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
最新記事
(01/30)
(01/18)
(12/16)
(12/12)
(11/25)
(11/25)
(11/24)
(11/24)
(11/22)
(11/17)
最新コメント
[12/25 日没]
[11/15 無色大師]
[11/12 無色大師]
[11/11 無色大師]
[11/08 無色大師]
リンク
新刊カレンダー
ブログ内検索
プロフィール
HN:
Nina.A
性別:
男性
趣味:
麻雀、ラノベ、漫画
自己紹介:
MJ4や天鳳等でよく麻雀やってます。もし会ったらよろしくです。
ブログは単なるメモ帳となる予定。
ブログは単なるメモ帳となる予定。
カウンタ
C/C++勉強中の大学生雑記
2025/11/15
08:44:10
2008/11/08
00:05:32
いつものパソコン以外のvimだと設定がされてなかったりするのでここに置いておく。
" vi非互換モード
set nocompatible
" 構文ハイライトをon
syntax on
" 行数表示
set number
" コマンド部の高さ指定
set cmdheight=1
" タブを4字に
" タブ8字の場合ts=8 sw=4 sts=4
set ts=4 sw=4 sts=0
" Tabを表示
set listchars=tab:>\
" 行数表示の色指定
set highlight=n:NONE
set list
" 全角スペースの可視化
if has("syntax")
syntax on
function! ActivateInvisibleIndicator()
syntax match InvisibleJISX0208Space " " display containedin=ALL
highlight InvisibleJISX0208Space term=underline ctermbg=Gray guibg=Gray
endf
augroup invisible
autocmd! invisible
autocmd BufNew,BufRead * call ActivateInvisibleIndicator()
augroup END
endif
"
" 補完機能制御
set wildmode=list:full
set wildmenu
" バッファ切り替え後もundo保持
set hidden
" AutoIndent
set autoindent
" ソフトタブ無効(タブ有効)
set noexpandtab
" 改行コードの自動認識
set fileformats=unix,dos,mac
" ステータスラインを常に表示
set laststatus=2
" ステータスラインに文字コードと改行文字を表示する
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P"
" BSの対応
set backspace=2
"
"
" 文字コードの自動認識
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 ambiwidth=double
" if exists('&ambiwidth')
" set ambiwidth=double
" endif
参考:ずんWiki - vim
PR
この記事にコメントする
