블로그 이미지
루미넌스
There are only 10 types of people, those who understand binary and those who do not.

calendar

    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    
2006/11/02 21:46 Dev 노트
UNIX환경의 대표적인 텍스트 에디터인 VI, EMACS.
그중 난 VI를 선호한다. 10년이 넘게 쓰다보니 손에 익어서 바꾸기가 어렵다.
요즘은(요즘이라 하기엔 쫌 오래전부터..) VI Improved라고 하여 VIM이 사용되고, VIM은 윈도우용으로도 포팅되어 있어 매우 편하다. 에디터는 하나만 잘 다루면 되니까..ㅎㅎ
근데 이노무 개발환경이란게 눈에 익지 않으면 보이던 버그도 보이지 않는법.. 그래서 어디서든 거의 비슷한 화면을 볼 수 있게 환경 설정 파일을 갖고 다닌다.
오늘은 내 VIM설정파일 .vimrc를 공개한다.

두가지 버전이 있다. 회사에서 터미널 작업을 할 때 쓰는 것과 M$윈도그XP가 설치된 PC에서 gvim을 쓸때 사용하는 것이다.
우선 리눅스 터미널에서 사용하는 .vimrc파일..
set nocompatible " VI 오리지널과 호환하는 모드를 사용하지 않음(VIM확장)
set number " 라인번호를 붙임
set backspace=indent,eol,start " BS로 라인끝과 처음 자동들여쓰기한 부분을 지날수 있음
set tabstop=4 " 탭문자는 4컬럼 크기로 보여주기
set shiftwidth=4 " 문단이나 라인을 쉬프트할 때 4컬럼씩 하기
set autoindent " 자동 들여쓰기
set visualbell " Alert 음을 화면 깜박임으로 바꿔보여주기
set laststatus=2 " 최종상태 2개 기억하기
set statusline=%h%F%m%r%=[%l:%c(%p%%)] " 상태표시줄 포맷팅
set hlsearch  " / ? 명령 등으로 찾은 문자열을 하일라이트 해준다.
syntax on " 적절히 Syntax에 따라 하일라이팅 해주기
set background=dark " 이건 터미널 모드에선 영향이 없다.

다음은 PC에서 사용하는 버전
" vimrc file: $VIM/_vimrc
source $VIM/_vimrc.org
set gfn=Courier_New
set bdlay=100
set backspace=indent,eol,start
set number
set ai
set ts=4
set sw=4
set vb  " visual bell
set background=dark

"
" geometry setting
set lines=57
set columns=120
winpos 0 0

"
" Color scheme
highlight Normal     guifg=Grey80 guibg=Black
highlight Search     guifg=Black guibg=lightred
highlight Visual     guifg=Grey25
highlight Cursor     guifg=Black guibg=lightblue
highlight Special    guifg=Orange
highlight Comment    guifg=#80a0ff
highlight StatusLine guifg=darkcyan  guibg=white
highlight Statement  guifg=Orange gui=NONE
highlight Type      gui=NONE

" vimrc file: $VIM/_vimrc.org
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  if &sh =~ '\<cmd'
  silent execute '!""C:\Program Files\Vim\vim64\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . '"'
  else
  silent execute '!C:\Program" Files\Vim\vim64\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  endif
endfunction

set number
set ai
set backspace=indent,eol,start
set ts=4

$VIMRUNTIME/에 있는 파일들은 설치시에 제공되는 rc파일을 그대로 이용했다.

[터미널에 적용한 모습]



덧, LangToHtml Plugin에는 vimrc syntax파일이 없다..ㅠㅠ
덧, 유용한 정보:VIM 간단한 set 변수들에 대한 설명
Creative Commons License
posted by 루미넌스