2011년 10월 5일 수요일

[VIM] vimrc

주력으로 사용하는 텍스트 편집기는 OS가 뭐든 vim이다.

현재 다음 설정을 $HOME/.vimrc 에 넣어두고 쓰고 있다


set nocompatible
"source $VIMRUNTIME/mswin.vim
"behave mswin

colorscheme torte

function! SetKernelIndent()
    set ts=8
    set sts=8
    set shiftwidth=8
    set noexpandtab
endfunction

function! SetAndroidIndent()
    set ts=4
    set sts=4
    set shiftwidth=4
    set expandtab
endfunction

"map ski :call SetKernelIndent
"map sai :call SetAndroidIndent

set ts=8
set sts=8
set shiftwidth=8
set noexpandtab

let  g:MultipleSearchMaxColors=8

set smarttab
set smartindent
"set expandtab false
set fencs=utf8,cp949
set ruler
set number
set hls
set ic " ignore case
set nowb " disable writebackup
set noacd " noautochdir

noremap  :Tlist
set t_Co=256

map s* :execute ':Search \<'.expand('').'\>'
map s8 :execute ':Search \<'.expand('').'\>'
map sr :SearchReset

noremap  
inoremap         
cnoremap         

filetype on
filetype indent on
filetype plugin on

if filereadable("tags")
        set tags=tags
endif
set tagbsearch  " enable binary search in ctags database

"cscope
set csto=0
set cst
set nocsverb

set cscopeverbose

" Ctrl+[ 는 ESC와 동일하므로, Ctrl+P로 변경
nmap c :cs find c =expand("") " Find functions calling this function
nmap d :cs find d =expand("") " Find functions called by this function
nmap e :cs find e =expand("") " Find this egrep pattern
nmap f :cs find f =expand("") " Find this file
nmap g :cs find g =expand("") " Find Find this definition
nmap i :cs find i ^=expand("")$ " Find files #including this file
nmap s :cs find s =expand("") " Find this C symbol
nmap t :cs find t =expand("") " Find assignments to
nmap h :cs help
nmap k :cs kill
nmap r :cs reset
nmap w :cs show

" resize window using vi navigation keys
nmap k -
nmap j +
nmap h :vertical resize -2
nmap l :vertical resize +2