2007/02/01

vimrc 설정하기

제가 쓰는 vimrc파일입니다.
주로 Window환경에서 gvim을 사용하기 때문에 윈도우 환경에 맞춰서 작성되었습니다.


"줄번호를 표시한다.
set nu
"자동으로 띄어쓰기를 한다.
set autoindent
"파일의 저장인코딩을 utf-8로 한다.
"set fileencodings=utf-8
"화면 문자의 인코딩을 cp949로한다.
set encoding=cp949
"한화면을 넘는 줄을 줄바꿈하지 않는다.
set nowrap
"한화면이 넘는 줄의 끝에 >나 <를 표시하여 내용이 더 있음을 알린다. set listchars=extends:>,precedes:< "탭의 길이를 4문자로한다. set tabstop=4 "탭을입력하면 space로 변환한다. set expandtab "indent를 할때 띄울 빈칸의 개수 set shiftwidth=4 "gvim에서 선택할 폰트 set guifont=돋움체:h10:cANSI "ctrl-F5를 누르면 현재 파일을 저장하고 파이썬으로 실행한다. map :w:!python %
filetype on
"컬러스킴을 vcbc로 설정한다. 컬러스킴은 http://www.vim.org에서 받을수 있다.
colorscheme vcbc
"syntax highlight 를 켠다
syntax on
"W도 w와 같이 동작한다.
cmap W w
"insert모드에서 를 누르면 IM을 disable시킨다.
inoremap :set imdisable
"visual이나 select모드에서 의 매핑이다.
"i,a,o를 누르면 IM을 disable시킨다.
nnoremap i :set noimdi
nnoremap I :set noimdI
nnoremap a :set noimda
nnoremap A :set noimdA
nnoremap o :set noimdo
nnoremap O :set noimdO

if has('multi_byte_ime')
highlight CursorIM guibg=green guifg=NONE
endif

" vim -b : edit binary using xxd-format!
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif
augroup END




"------------------------------------------------------------------------------
" Standard stuff.
"------------------------------------------------------------------------------

set nocompatible " Disable vi compatibility.
set textwidth=0 " Don't wrap words by default.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set showmode " Show current mode.
set ruler " Show the line and column numbers of the cursor.
set ignorecase " Case insensitive matching.
set incsearch " Incremental search.
set noerrorbells " No beeps.
set modeline " Enable modeline.
set esckeys " Cursor keys in insert mode.
set gdefault " Use 'g' flag by default with :s/foo/bar/.
set magic " Use 'magic' patterns (extended regular expressions).
set ttyscroll=0 " Turn off scrolling (this is faster).
set ttyfast " We have a fast terminal connection.
set hlsearch " Highlight search matches.

set nostartofline " Do not jump to first character with page commands,
" i.e., keep the cursor in the current column.
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start

" Path/file expansion in colon-mode.
set wildmode=list:longest
set wildchar=

" Enable syntax-highlighting.
if has("syntax")
syntax on
endif

"------------------------------------------------------------------------------
" Function keys.
"------------------------------------------------------------------------------

" F1: Toggle hlsearch (highlight search matches).
nmap :set hls!

" F2: Toggle list (display unprintable characters).
nnoremap :set list!

" F3: Toggle expansion of tabs to spaces.
nmap :set expandtab!

" F4: Write a ChangeLog entry.
map :r !c:\\cygwin\\bin\\date.exe +\%Y/\%m/\%dA 김석민 * |

" F5: Insert current date.
map :r !c:\\cygwin\\bin\\date.exe +\%Y/\%m/\%d


"------------------------------------------------------------------------------
" Correct typos.
"------------------------------------------------------------------------------

" English.
iab beacuse because
iab becuase because
iab acn can
iab cna can
iab centre center
iab chnage change
iab chnages changes
iab chnaged changed
iab chnagelog changelog
iab Chnage Change
iab Chnages Changes
iab ChnageLog ChangeLog
iab debain debian
iab Debain Debian
iab defualt default
iab Defualt Default
iab differnt different
iab diffrent different
iab emial email
iab Emial Email
iab figth fight
iab figther fighter
iab fro for
iab fucntion function
iab ahve have
iab homepgae homepage
iab logifle logfile
iab lokk look
iab lokking looking
iab mial mail
iab Mial Mail
iab miantainer maintainer
iab amke make
iab mroe more
iab nwe new
iab recieve receive
iab recieved received
iab erturn return
iab retrun return
iab retunr return
iab seperate separate
iab shoudl should
iab soem some
iab taht that
iab thta that
iab teh the
iab tehy they
iab truely truly
iab waht what
iab wiht with
iab whic which
iab whihc which
iab yuo you
iab databse database
iab versnio version
iab obnsolete obsolete
iab flase false
iab recrusive recursive
iab Recrusive Recursive

" German.
iab cioa ciao
iab Cioa Ciao
iab nciht nicht
iab zeimlicher ziemlicher
iab zeimlich ziemlich
iab scheisse schei??e
iab Scheisse Schei??e
iab morgne morgen
iab Morgne Morgen

" Days of week.
iab monday Monday
iab tuesday Tuesday
iab wednesday Wednesday
iab thursday Thursday
iab friday Friday
iab saturday Saturday
iab sunday Sunday

"------------------------------------------------------------------------------
" Abbreviations.
"------------------------------------------------------------------------------

" My name + email address.
ab uhh 김석민


" Quit with 'q' instead of ':q'. VERY useful!
map q :q


"------------------------------------------------------------------------------
" HTML.
"------------------------------------------------------------------------------

" Print an empty tag.
map! ;h
5hi

" Wrap an tag around the URL under the cursor.
map ;H lBi
3hi


"------------------------------------------------------------------------------
" Miscellaneous stuff.
"------------------------------------------------------------------------------

" ROT13 decode/encode the selected text (visual mode).
" Alternative: 'unmap g' and then use 'g?'.
vmap rot :!to A-Za-z N-ZA-Mn-za-m



"------------------------------------------------------------------------------
" File-type specific settings.
"------------------------------------------------------------------------------

if has("autocmd")

" Enabled file type detection and file-type specific plugins.
" filetype plugin on indent
filetype plugin on

" Drupal *.module and *.engine files.
augroup module
autocmd BufRead *.module,*.engine set filetype=php
augroup END

augroup sql
autocmd BufReadPre,FileReadPre *.sql set tabstop=4
autocmd BufReadPre,FileReadPre *.sql set expandtab
augroup END

" Python code.
augroup python
autocmd BufReadPre,FileReadPre *.py set tabstop=4
autocmd BufReadPre,FileReadPre *.py set expandtab
augroup END

" Ruby code.
augroup ruby
autocmd BufReadPre,FileReadPre *.rb set tabstop=2
autocmd BufReadPre,FileReadPre *.rb set expandtab
augroup END

" PHP code.
augroup php
autocmd BufReadPre,FileReadPre *.php set tabstop=4
autocmd BufReadPre,FileReadPre *.php set expandtab
augroup END

" Java code.
augroup java
autocmd BufReadPre,FileReadPre *.java set tabstop=4
autocmd BufReadPre,FileReadPre *.java set expandtab
augroup END

" ANT build.xml files.
augroup xml
autocmd BufReadPre,FileReadPre build.xml set tabstop=4
augroup END

" (J)Flex files.
augroup lex
" autocmd BufRead,BufNewFile *.flex,*.jflex set filetype=lex
autocmd BufRead,BufNewFile *.flex,*.jflex set filetype=jflex
augroup END

" (Nu)SMV files.
augroup smv
autocmd BufRead,BufNewFile *.smv set filetype=smv
augroup END
endif


댓글 없음: