忍者ブログ
ADMIN / ENTRY
カレンダー
02 2024/03 04
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
31
新刊カレンダー
ブログ内検索
プロフィール
HN:
Nina.A
性別:
男性
趣味:
麻雀、ラノベ、漫画
自己紹介:
MJ4や天鳳等でよく麻雀やってます。もし会ったらよろしくです。
ブログは単なるメモ帳となる予定。
C/C++勉強中の大学生雑記
<<  2024/03  >>
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 
[10]  [9]  [8]  [7]  [6]  [5]  [4]  [3]  [2]  [1
2024/03/19  11:54:32
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

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 - vimExtrernal Link

PR
この記事にコメントする
お名前:
タイトル:
文字色:
メールアドレス:
URL:
コメント:
パスワード:   Vodafone絵文字 i-mode絵文字 Ezweb絵文字
この記事へのトラックバック
この記事にトラックバックする:
Powerd by NINJAブログ / Designed by SUSH
Copyright © メモ帳ブログ All Rights Reserved.
忍者ブログ [PR]