2014년 3월 9일 일요일

VIM 설정

sudo apt-get install vim 으로 VIM 설정

  • vi 에서 직접 설정(일회성)
- 줄번호를 보려면
:set number
또는 줄여서
:set nu

- 반대로 줄번호를 없애려면:set nonumber
또는 줄여서
:set nonu

- syntax hilight 기능(프로그램 문법에 색깔나오는 기능) 사용하는 법
:syntax on
또는 줄여서
:syn on

- syntax hilight 사용하지 않으려면
:syntax  off
또는 줄여서
:syn off

set expandtap : 탭을 공백으로

set fileencodings=ucs-bom,utf-8,euc-kr

set nu
set autoindent
set cindent

set laststatus=2
set statusline=%(%F%h%m%r%h%w%y\%{strftime(\"%Y/%m/%d-%H:%M\")}%=\col:%c%V\ascii:%b\posi%o\lin:%l\,%L\%P#

set hi=1000

if v:lang=~"^ko"
    set encoding=cp949
    set fileencodings=utf-8,cp949
    set guifontset=-%-%-medium-r-normal--16-*-*-*-*-*-*-*

elseif v:lang=~"^ja_JP"
    set fileencodings=euc-jp
    set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*

elseif v:lang=~"^zh_TW"
    set fileencodings=big5
    set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-l,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0

elseif v:lang=~"zh_CN"
    set fileencodings=gb2312
    set guifontset=*-r-*

endif

if v:lang=~"utf8$"||v:lang=~"UTF-8$"
    set encoding=utf-8
    set fileencodings=utf-8,cp949

endif

set bs=indent,eol,start

filetype on
au FileType c,cpp,cs,html,css,php,php4,js,css,jsp,sh set nu

filetype on
au FileType html, js css set ts=4

set scs
syntax on
set smartindent
set ruler










"===================================================
"=         cygwin and common bash - vimrc          =
"===================================================
"=        definition by rageworx@gmail.com         =
"===================================================

"if you want make VI to korean, enables following set.
"*Warnning*
"  most of modern Linuxs are supports automatically
"  UTF-8 for each different languages.
"  Ubuntu dosen't need set following set.
"set fileencodings=euc-kr

set fileformat=dos
set fileformats=dos,unix
"set encoding=cp949

"set backup
"set backupdir=~/.vim/backup
"file format. dos.
"set fileformat=dos
"set fileformat=unix
"set nowrap
"set listchars=extends:>,precedes:<
set scrolloff=3

syntax on
"set vb
set bg=dark

"show actual cursor position
set ruler

set cindent
"tags

set shiftwidth=4
set tabstop=4
"set expandtab
"set noexpandtab
"set smarttab
"set nohlsearch
set hlsearch
set incsearch
set ignorecase
set autowrite
set autoindent
set nostartofline
set backspace=indent,eol,start
set backspace=2
set bioskey
set nu
" if &term == "linux"
"         set t_kb
" endif
" if &term == "xterm"
"         set t_kb
" endif

" show matching braces
set showmatch

au BufNewFile,BufReadPost Makefile se noexpandtab

"When editing a file, always jump to the last known cursor position.
"Don't do it when the position is invalid or when inside an event handler
"(happens when dropping a file on gvim).
autocmd BufReadPost *
  \ if line("'\"") > 0 && line("'\"") <= line("$") |
  \   exe "normal g`\"" |
  \ endif
" CVS stuff
cmap UP<CR> !cvs update %<CR>:e! %<CR>
cmap CI<CR> !cvs commit %<CR>

"w, q
cmap W<CR> w<CR>
cmap Q<CR> q<CR>

"Comment formatting
"set formatoptions=tcroq
set formatoptions=croql
set textwidth=80

"status bar.
set laststatus=2

"--------------maps
"To see man page on selected ANSI/POSIX standard functions.
map <F1> K

"Save current document.
"map <F2> :w!<CR>

"Show slected function where it placed.
map <F2> mk[[?^[A-Za-z_].*(<CR>V"ky`k:echo "<C-R>k"<CR>

"map <F3> v%zf
"map <ESC>[13~ v]}zf
"map <ESC>[25~ v]}zf

"shift-F3
"Enables source code syntax-highlight.
map <F3> v]}zf

"Recovers folded document.
"File Browsing.
map <F4> zo

"Dividing current screen to as frame and shows left side a directories.
map <F5> :25vs./<CR>:set nonumber<CR><C-w>w

"To switching cursor at different frame.
map <F6> <C-w>w

"To open file at cursor.
map <F7> O

"Too see prototype at current cursor , press F8.
map <F8> [i

"go to definition of function.
map <F9> gd

"go back to previous place.
map <F10> ''

"takign trace method and functions at cursor.
map <F11> <C-]>

"To quit tracing.
map <F12> <C-t>

"syntax highlited source code to html. wow!
com -nargs=0 Html :so $VIMRUNTIME/syntax/2html.vim

"set statusline=\ %<%l:%v\ [%P]%=0x%B\ \ %a\ %n%m%r\ %f\
set statusline=\(%n\)%<%f\ %h%m%r%=0x%B\ \ \ \ %-14.(%l,%c%V%)\ %P

" doxygen, end line comment
vm <ESC>z <ESC>`>a */<ESC>`<i/**< <ESC>`<
" block comment
vm <ESC>c <ESC>`>a */<ESC>`<i/* <ESC>`<
" block comment
vm ,// <ESC>`>a */<ESC>`<i/* <ESC>`<
" line commentify
nm <ESC>c ^i/* <ESC>$a */<ESC>^
" doxygen line commentify
nm <ESC>z ^i/** <ESC>$a */<ESC>^
" line commentify
nm ,// ^i/* <ESC>$a */<ESC>^

댓글 없음:

댓글 쓰기