Skip to content

Instantly share code, notes, and snippets.

@yono
Created May 13, 2010 12:24
Show Gist options
  • Save yono/399772 to your computer and use it in GitHub Desktop.
Save yono/399772 to your computer and use it in GitHub Desktop.
""""""""""""""""
" .vimrc
" utf-8
""""""""""""""""
set t_Co=256
"-----------------------
" vi $B$H$N8_49%b!<%I(BOFF
"-----------------------
set nocompatible
set term=ansi
"-----------------------
" $BJ8;z%3!<%I@_Dj(B
"-----------------------
set enc=utf-8
set fencs=iso-2022-jp,utf-8,cp932,euc-jp
"-----------------------
" $B%F%s%W%l!<%H:n@.(B
"-----------------------
:autocmd BufNewFile *.py 0r /Users/yono/.vim/templates/skeleton.py
:autocmd BufNewFile *.sh 0r /Users/yono/.vim/templates/skeleton.sh
"-----------------------
" $BJ8;z%3!<%I$N<+F0G'<1(B
"-----------------------
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$B$,(BeucJP-ms$B$KBP1~$7$F$$$k$+$r%A%'%C%/(B
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$B$,(BJISX0213$B$KBP1~$7$F$$$k$+$r%A%'%C%/(B
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$B$r9=C[(B
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
" $BDj?t$r=hJ,(B
unlet s:enc_euc
unlet s:enc_jis
endif
" $BF|K\8l$r4^$^$J$$>l9g$O(B fileencoding $B$K(B encoding $B$r;H$&$h$&$K$9$k(B
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
" $B2~9T%3!<%I$N<+F0G'<1(B
set fileformats=unix,dos,mac
" $B""$H$+!{$NJ8;z$,$"$C$F$b%+!<%=%k0LCV$,$:$l$J$$$h$&$K$9$k(B
"if exists('&ambiwidth')
set ambiwidth=double
"endif
" $B8!:w;~$KBgJ8;z>.J8;z$r6hJL$7$J$$(B
set ignorecase
set smartcase
set wrapscan
set incsearch
set hlsearch
"set cursorline
set autoindent
set cindent
set tabstop=4
set shiftwidth=4
set expandtab
set number
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.']'}
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
if has('autochdir')
set autochdir
endif
if has('migemo')
set migemo
endif
if has('kaoriya')
set iminsert=0
set imsearch=0
endif
filetype plugin indent on
syntax on
hi Search ctermbg=DarkBlue ctermfg=White
hi Pmenu ctermbg=Magenta
hi PmenuSel ctermbg=DarkGrey
hi PmenuSbar ctermbg=Grey
hi PmenuThumb cterm=reverse
autocmd FileType ruby set tabstop=2 tw=0 sw=2 expandtab
autocmd FileType eruby set tabstop=2 tw=0 sw=2 expandtab
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
" rails.vim
let g:rails_level=4
let g:rails_default_file="app/controllers/application.rb"
let g:rails_default_database="sqlite3"
" rubycomplete.vim
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
" search
nmap n nzz
nmap N Nzz
nmap * *zz
nmap # #zz
nmap g* g*zz
nmap g# g#zz
" edit binary file
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
color darkblue
set backspace=indent,eol,start
autocmd FileType python source ~/.vim/plugin/python.vim
set t_Co=256
"colorscheme vividchalk
colorscheme railscasts
let loaded_explorer=1
set hlsearch
nmap <Esc><Esc> :nohlsearch<CR><Esc>
" For outputz
let g:outputz_key = 'Xxjw3TuWqOQN'
" set textwidth=80
let g:SrcExpl_RefreshTime = 1
let g:SrcExpl_UpdateTags = 1
set runtimepath+=~/qfixapp
let howm_dir = "~/hwom"
let howm_filename = '%Y/%m/%Y-%m-%d-%H%M%S.hown'
let howm_fileencoding = 'utf-8'
let howm_fileformat = 'unix'
" for cg
autocmd BufWritePost *.mkd :silent !cg convert % > /dev/null && reload_firefox.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment