'vim 설정'에 해당되는 글 1건

  1. 2012.06.11 vimrc 설정

vimrc 설정

ITWeb/서버관리 2012.06.11 12:51

[원본글]


저는 최소 설정만 주로 사용합니다.

syntax on

filetype on


set encoding=utf-8

set fileencodings=utf-8,cp949,default,latin1

set termencoding=utf-8


set number

set autoindent

set cindent

set smartindent

set ruler


set nocompatible

set shiftwidth=4

set tabstop=4

set showmatch

set backspace=indent,eol,start

set backspace=2


set paste

set history=500

set hlsearch


set wrapscan


[원본내용]

 1 " #################### Vim ####################
  2 " ########## File ##########
  3 set nocompatible
  4 set backspace=indent,eol,start " Backspace 사용에 이전 줄과 연결
  5 set backup " Backup 활성화
  6 set backupdir=~/.vim/backup
  7 set history=50 " 명령어 기록 수
  8 set novisualbell " 화면 깜빡임 사용안함
  9 set noerrorbells " 오류음 사용안함
 10 set lazyredraw " 매크로 실행중 화면을 다시 그리지 않음
 11 set loadplugins " 프로그램 시작시에 플러그인 로딩
 12 
 13 set encoding=utf-8 " encoding 설정
 14 set fileencodings=utf-8,cp949,default,latin1
 15 set termencoding=utf-8
 16 
 17 set printencoding=utf-8 " 인쇄 encoding 옵션
 18 set printmbcharset=ISO10646
 19 set printmbfont=r:NanumGothiccoding,c:yes,a:yes
 20 
 21 " GUI 설정
 22 if has("gui_running")
 23     " 글꼴 설정
 24     if has("win32")
 25         set guifont=Consolas:h9:cHANGEUL
 26     elseif has("unix")
 27         set guifont=Consolas\ 9 " 글꼴 설정
 28         set guifontwide=NanumGothicCoding\ 9
 29     endif
 30     set printfont=NanumGothicCoding\ 9
 31 
 32     " 메뉴 설정
 33     " set go-=m " 메뉴
 34     " set go-=T " 툴바
 35     set go-=l " 스크롤바
 36     set go-=L
 37     set go-=r
 38     set go-=R
 39     set go-=b
 40 
 41     " 마우스 설정
 42     set mouse=n " 마우스 이동제한
 43     set nomousefocus
 44     set mousemodel=popup " 마우스 동작은 popup
 45 
 46     " 창 크기 설정
 47     set lines=40
 48     set co=90
 49 endif
 50 
 51 " 이전 편집 부분에서 다시 열기
 52 autocmd BufReadPost *
 53     \ if line("'\"") > 1 && line("'\"") <= line("$") |
 54     \   exe "normal! g`\"" |
 55     \ endif
 56 
 57 " ########## Edit ##########
 58 set paste " 붙여넣기시 계단 현상 제거
 59 set foldmethod=manual " 코드 생략은 파일형식에서 설정
 60 set autoindent " 자동 들여쓰기 사용
 61 set wrapscan " 검색시, 파일 끝에서 되돌리기
 62 set nojoinspaces " 줄 연결은 공백을 하나만 지정함
 63 set tabstop=4 " tab 간격
 64 set expandtab
 65 set softtabstop=4
 66 set shiftwidth=4 " 자동 들여쓰기 간격
 67 set showmatch " 괄호 반전
 68 set autowrite " 자동저장
 69 set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " 공백문자 표시
 70 set list
 71 set dip=iwhite " 파일비교시 공백만 무시
 72 set textwidth=0 " 텍스트 입력의 width 제한은 없음
 73 
 74 " ########## Tool ##########
 75 " ########## Syntax ##########
 76 " highlight를 표시함
 77 if &t_Co > 2 || has("gui_running")
 78     syntax on
 79     set hlsearch
 80 endif
 81 
 82 highlight clear
 83 set background=dark
 84 highlight Normal     guifg=Gray80 guibg=Black ctermfg=White
 85 highlight Search     guifg=LightRed guibg=Black gui=reverse ctermfg=LightRed ctermbg=DarkGray cterm=reverse
 86 highlight Visual     guifg=Gray25 guibg=DarkGray ctermfg=LightGray ctermbg=DarkGray
 87 highlight Cursor     guifg=Black guibg=Green ctermfg=Black ctermbg=Green
 88 highlight CursorIM   guifg=Black guibg=Yellow ctermfg=Black ctermbg=Yellow
 89 highlight Special    guifg=Orange ctermfg=Brown
 90 highlight Comment    guifg=Green guibg=Black ctermfg=DarkGreen gui=italic
 91 highlight StatusLine guifg=White guibg=Blue gui=NONE ctermfg=White ctermbg=Blue
 92 highlight Statement  guifg=Yellow gui=NONE ctermfg=Yellow cterm=NONE
 93 highlight Type       guifg=Cyan gui=NONE ctermfg=Cyan
 94 highlight Structure  guifg=Red  guibg=Black
 95 highlight Constant   guifg=Green guibg=Black ctermfg=Gray
 96 highlight String     guifg=LightMagenta guibg=Black ctermfg=LightMagenta gui=italic
 97 highlight Number     guifg=Magenta ctermfg=Magenta
 98 highlight Identifier guifg=Orange guibg=Black ctermfg=DarkYellow
 99 highlight MatchParen guifg=Black guibg=LightBlue
100 highlight Folded     guifg=Orange guibg=Black ctermfg=DarkGreen
101 highlight link IncSearch   Visual
102 highlight link Character   Constant
103 highlight link Boolean     Constant
104 highlight link Float       Number
105 highlight link typedef     Type
106 highlight link Operator    Statement
107 highlight link Keyword     Statement
108 highlight link Exception   Statement
109 
110 " ########## Window ##########
111 set number " 줄번호 표시
112 set nuw=5
113 set linespace=0 " 줄간격
114 set nowrap " 줄바꿈 안함
115 set ruler " 커서 위치를 표시함
116 set showcmd " 마지막 라인에 커맨드표시
117 
118 " Status 모양
119 highlight User1 term=underline cterm=bold ctermfg=Cyan ctermbg=Blue gui=underline gui=bold guifg=#40ffff guibg=#0000aa
120 highlight User2 term=underline cterm=underline ctermfg=green gui=underline guifg=#00ff00
121 highlight User3 term=underline cterm=underline ctermfg=yellow gui=underline guifg=#ffff00
122 highlight User4 term=underline cterm=underline ctermfg=white gui=underline guifg=#ffffff
123 highlight User5 ctermfg=cyan
124 highlight User6 ctermfg=white
125 set statusline=%4*%<\ %1*[%F]
126 set statusline+=%4*\ %5*[%{&encoding}, " encoding
127 set statusline+=%{&fileformat}]%m " file format
128 set statusline+=%4*%=\ %6*%y%4*\ %3*%l%4*/%L,\ %3*%c%4*\ \<\ %2*%P%4*\ \>
129 set laststatus=2
130 
131 " ########## Short Cuts ##########
132 " Shift+Enter로 아래줄로 커서 넘기기 기능
133 map <S-CR> <ESC>o
134 map! <S-CR> <ESC>o
135 "현재 줄의 마지막에 이어 쓰기
136 map! <C-TAB> <S-CR><ESC>i<BACKSPACE>
137 " 영역이 지정된 상태에서 Tab과 Shift+Tab으로 들여쓰기/내어쓰기를 할 수 있도록 함.
138 " map <Tab> >gv
139 " map <S-Tab> <gv
140 " Tab 열기, 이동
141 map <F2> :tabnew<CR>
142 map <F4> :w<CR>
143 map <C-h> gT
144 map <C-l> gt
145 " 코드 폴딩
146 " map <C-k> zc
147 " map <C-j> zo
148 " Shell 호출
149 map <F9> :shell<CR>
150 
151 " Trinity의 설정
152 "" Open and close all the three plugins on the same time
153 nmap <F8> :TrinityToggleAll<CR>
154 " // Set the height of Source Explorer window
155 let g:SrcExpl_winHeight = 8
156 " // Set 100 ms for refreshing the Source Explorer
157 let g:SrcExpl_refreshTime = 100
158 " // Set "Enter" key to jump into the exact definition context
159 " let g:SrcExpl_jumpKey = "<ENTER>"
160 " // Set "Space" key for back from the definition context
161 let g:SrcExpl_gobackKey = "<SPACE>"
162 " // In order to Avoid conflicts, the Source Explorer should know what plugins
163 " // are using buffers. And you need add their bufname into the list below
164 " // according to the command ":buffers!"
165 let g:SrcExpl_pluginList = [
166         \ "__Tag_List__",
167         \ "_NERD_tree_",
168         \ "Source_Explorer"
169     \ ]
170 " // Enable/Disable the local definition searching, and note that this is not
171 " // guaranteed to work, the Source Explorer doesn't check the syntax for now.
172 " // It only searches for a match with the keyword according to command 'gd'
173 let g:SrcExpl_searchLocalDef = 1
174 " // Do not let the Source Explorer update the tags file when opening
175 let g:SrcExpl_isUpdateTags = 0
176 " // Use 'Exuberant Ctags' with '--sort=foldcase -R .' or '-L cscope.files' to
177 " //  create/update a tags file
178 let g:SrcExpl_updateTagsCmd = "ctags --sort=foldcase -R ."
179 " // Set "<F12>" key for updating the tags file artificially
180 let g:SrcExpl_updateTagsKey = "<F12>"
181 
182 " ########## File Type ##########
183 filetype plugin on " 파일 종류 자동 인식
184 filetype indent on
185 
186 if has("autocmd")
187     autocmd FileType * map <F12> :w<CR>
188 
189     " 자동완성
190     autocmd FileType * inoremap { {}<LEFT>
191     autocmd FileType * inoremap [ []<LEFT>
192     autocmd FileType * inoremap ( ()<LEFT>
193     autocmd FileType * inoremap " ""<LEFT>
194     autocmd FileType * inoremap ' ''<LEFT>
195 
196     " Python 설정
197     autocmd BufNewFile,BufRead *.py setfiletype python
198     autocmd BufNewFile *.py 0r ~/.vim/templetes/skeleton.py
199     autocmd FileType python set syntax=python
200     autocmd FileType python set autoindent
201     autocmd FileType python set foldmethod=indent
202     autocmd FileType python       set complete+=k~/.vim/syntax/python.vim isk+=.,(
203     autocmd FileType python noremap <F12> :w<CR>:!python %<CR>
204     autocmd FileType python noremap <C-F12> :w<CR>:!python %
205 
206     " R 설정
207     autocmd BufNewFile,BufRead *.R setfiletype r
208     autocmd BufNewFile *.R         0r ~/.vim/templetes/skeleton.R
209     autocmd FileType r set syntax=r
210     autocmd FileType r set autoindent
211     autocmd FileType r set foldmethod=indent
212     autocmd BufNewFile,BufRead *.R  inoremap { {<CR>}<C-O>O
213 
214     " Graphviz 설정
215     autocmd BufNewFile,BufRead *.dot set autoindent
216     autocmd BufNewFile         *.dot 0r ~/.vim/templetes/skeleton.dot
217     autocmd BufNewFile,BufRead *.dot noremap <F12> :w<CR>:!dot -Tpng % -O<CR>:!eog %.png<CR>
218 endif

신고
tags : ,
Trackback 0 : Comment 0