Skip to content

Instantly share code, notes, and snippets.

@sorah
Created September 15, 2009 04:46
Show Gist options
  • Save sorah/187122 to your computer and use it in GitHub Desktop.
Save sorah/187122 to your computer and use it in GitHub Desktop.
"viとの互換モードをオフ
set nocompatible
"行数表示
set number
"エンコードetcを設定
set enc=utf-8
set fencs=iso-2022-jp,euc-jp,cp932
set ambiwidth=double
"検索に関する設定
set ignorecase
set smartcase
set wrapscan
set incsearch
set hlsearch
"インデントに関する設定
set autoindent
set cindent
set tabstop=4
set shiftwidth=4
set expandtab
set noruler
set nolist
set showmatch
set wrap
set title
"下部ステータスライン、コマンド部分に関する設定
set showcmd
set cmdheight=2
set laststatus=2
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}
"ファイル名などのTab補完の設定
set wildmenu
set backspace=2
set scrolloff=5
set formatoptions+=mM
let format_join_spaces = 4
let format_allow_over_tw = 1
set nobackup
set history=1000
set mouse=a
set autochdir
"日本語入力関係?
set imdisable
set iminsert=1
set imsearch=1
"filetypeのプラグインを読み込む
filetype plugin on
filetype plugin indent on
"シンタックス・ハイライトを有効にする
syntax on
"検索してhitしたワードをハイライト
hi Search term=reverse ctermbg=DarkBlue ctermfg=NONE
"Rails etcのautocmd
augroup Rails_etc
autocmd!
autocmd BufNewFile,BufRead app/*/*.rhtml set ft=mason fenc=utf-8
autocmd BufNewFile,BufRead app/**/*.rb set ft=ruby fenc=utf-8
autocmd BufNewFile,BufRead app/**/*.yml set ft=ruby fenc=utf-8
autocmd FileType c hi Comment ctermfg=darkcyan
autocmd FileType cpp hi Comment ctermfg=darkcyan
augroup END
" search
nmap n nzz
nmap N Nzz
nmap * *zz
nmap # #zz
nmap g* g*zz
nmap g# g#zz
"GNU screen用
if &term !~ "xterm-color"
autocmd BufEnter * if bufname("") !~ "^?[A-Za-z0-9?]*://" | silent! exe '!echo -n "^[k[`basename %`]^[??"' | endif
autocmd VimLeave * silent! exe '!echo -n "^[k`dirs`^[??"'
endif
"XMLで</と入力するだけで自動でタグ閉じ
augroup MyXML
autocmd!
autocmd Filetype xml inoremap <buffer> </ </<C-x><C-o>
augroup END
"git.vimのコミットを素早くするためのnnoremap
nnoremap <C-a> :GitCommit -am
"スワップ散らばり防止
set directory-=.
"補完に関する設定
"autocmd FileType ruby :set dictionary+=~/.vim/dict/ruby.dict
"autocmd FileType php :set dictionary+=~/.vim/dict/php.dict
"autocmd FileType python :set dictionary+=~/.vim/dict/python.dict
"set complete+=k
"inoremap <C-s> <C-x><C-k>
"inoremap <C-d> <C-x><C-o>
"vimの戦闘力を一発で計算する
command! CalcFP :echo len(filter(readfile($MYVIMRC),'v:val !~ "^\\s*$\\|^\\s*\""'))
"hatena.vim
set runtimepath+=~/.vim/hatena
"ruby tab indentの設定
augroup RubyIndent
autocmd!
autocmd Filetype rb set tabstop=4
autocmd Filetype rb set shiftwidth=4
augroup END
"印刷設定
set printoptions=wrap:y,number:y,header:0
set printfont=Andale_Mono:h12:cUTF8
"neocomplcacheの設定
let g:NeoComplCache_EnableAtStartup = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment