forked from ygpark/vimconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
311 lines (265 loc) · 9.75 KB
/
vimrc
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
"주의: Source Explorer의 충돌을 피하기 위해서 SrcExpl_pluginList를 새로 작성
"====================================================
"= Bundle
"====================================================
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
set nocompatible " be iMproved
filetype off " required!
set rtp =~/.vim/bundle/vundle
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
Bundle 'snipMate'
Bundle 'L9'
Bundle 'FuzzyFinder'
Bundle 'The-NERD-tree'
Bundle 'taglist.vim'
Bundle 'bufexplorer.zip'
Bundle 'DirDiff.vim'
Bundle 'git://github.com/wesleyche/SrcExpl.git'
Bundle 'SuperTab'
"Bundle 'SuperTab-continued.'
Bundle 'cscope_macros.vim'
Bundle 'gtags.vim'
Bundle 'OmniCppComplete'
Bundle 'armasm'
Bundle 'https://github.com/dhruvasagar/vim-table-mode.git'
"주석달기: \cc, \cn, \cs
"다른모양 주석 설정: \ca
"주석해제: \<space>
Bundle 'The-NERD-Commenter'
Bundle 'AutoComplPop'
"Bottom Bar
Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
"Git Plugin
Bundle 'tpope/vim-fugitive'
Bundle 'klen/python-mode'
filetype plugin indent on " required!
"====================================================
"= 어셈블리 파일을 C처럼 인식하여 주석을 달기 위한 트릭
"====================================================
au BufRead,BufNewFile *.S set ft=c
"====================================================
"= 기본 설정
"====================================================
set cindent "들여쓰기 설정
set ruler " 화면 우측 하단에 현재 커서의 위치(줄,칸)를 보여준다.
set number " 줄번호 출력
set modifiable
set hlsearch " Highlight Search
set ts=4 " tab stop - tab 크기
set sw=4 " shift width - shift 크기 조절
set sts=4 " soft tab stop - tab 이동 크기
set expandtab
set incsearch
set printoptions=portrait:n,wrap:n,duplex:off
set fileencodings=utf-8,euc-kr
colorscheme desert
"==========================
"= autocmd
"==========================
autocmd BufEnter *.c setlocal ts=8 sw=8 sts=8 noexpandtab
autocmd BufEnter *.S setlocal ts=8 sw=8 sts=8 noexpandtab
autocmd BufEnter *.py setlocal ts=8 sw=8 sts=8 noexpandtab
autocmd BufEnter Makefile setlocal ts=8 sw=8 sts=8 noexpandtab
autocmd BufEnter .* setlocal ts=8 sw=8 sts=8 noexpandtab nocindent
autocmd BufEnter *.md setlocal ts=8 sw=8 sts=8 noexpandtab nocindent
"augroup vimrc_autocmds
" autocmd!
" highlight characters past column 120
autocmd FileType python highlight Excess ctermbg=DarkGrey guibg=Black
autocmd FileType python match Excess /\0v.*/
autocmd FileType python set nowrap
" augroup END
autocmd BufEnter *.sh setlocal ts=8 sw=8 sts=8 noexpandtab nocindent
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
"====================================================
" Powerline setup
"====================================================
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 9
set laststatus=2
"====================================================
"= gtags.vim 설정
"====================================================
nmap <C-F2> :copen<CR>
nmap <C-F4> :cclose<CR>
nmap <C-F5> :Gtags<SPACE>
nmap <C-F6> :Gtags -f %<CR>
nmap <C-F7> :GtagsCursor<CR>
nmap <C-F8> :Gozilla<CR>
nmap <C-n> :cn<CR>
nmap <C-p> :cp<CR>
nmap <C-\><C-]> :GtagsCursor<CR>
"====================================================
"= 키맵핑
"====================================================
" <F3> 이전 정의로 이동 (SrcExpl 플러그인이 설정)
" <F4> 다음 정의로 이동 (SrcExpl 플러그인이 설정)
map <F2> :NERDTreeToggle<CR>
map <F3> :BufExplorer<cr>
map <F4> :SrcExplToggle<CR>
map <F5> :TlistToggle<CR>
"===== PageUP PageDown
map <PageUp> <C-U><C-U>
map <PageDown> <C-D><C-D>
"===== Vim 내의 창 크기 조절
nmap <s-h> <C-W><
nmap <s-j> <C-W>-
nmap <s-k> <C-W>
nmap <s-l> <C-W>>
"===== Vim 내에서 창 간 이동
nmap <c-h> <c-w>h
nmap <c-j> <c-w>j
nmap <c-k> <c-w>k
nmap <c-l> <c-w>l
"===== 버퍼간 이동
map ,x :bn!<CR> " Switch to Next File Buffer
map ,z :bp!<CR> " Switch to Previous File Buffer
map ,w :bw<CR> " Close Current File Buffer
map ,1 :b!1<CR> " Switch to File Buffer #1
map ,2 :b!2<CR> " Switch to File Buffer #2
map ,3 :b!3<CR> " Switch to File Buffer #3
map ,4 :b!4<CR> " Switch to File Buffer #4
map ,5 :b!5<CR> " Switch to File Buffer #5
map ,6 :b!6<CR> " Switch to File Buffer #6
map ,7 :b!7<CR> " Switch to File Buffer #7
map ,8 :b!8<CR> " Switch to File Buffer #8
map ,9 :b!9<CR> " Switch to File Buffer #9
map ,0 :b!0<CR> " Switch to File Buffer #0
"===== gtags.vim
nmap <C-n> :cn<CR>
nmap <C-p> :cp<CR>
nmap <C-\><C-]> :GtagsCursor<CR>
"===== make
let startdir = getcwd()
func! Make()
exe "!cd ".startdir
exe "make"
endfunc
nmap ,mk :call Make()<cr><cr>
"===== hexViewer
let b:hexViewer = 0
func! Hv()
if (b:hexViewer == 0)
let b:hexViewer = 1
exe "%!xxd"
else
let b:hexViewer = 0
exe "%!xxd -r"
endif
endfunc
nmap ,h :call Hv()<cr>
"===== man
func! Man()
let sm = expand("<cword>")
exe "!man -S 2:3:4:5:6:7:8:9:tcl:n:l:p:o ".sm
endfunc
nmap ,ma :call Man()<cr><cr>
"====================================================
"= Source Explorer config
"====================================================
" // Set the height of Source Explorer window
let g:SrcExpl_winHeight = 8
" // Set 100 ms for refreshing the Source Explorer
let g:SrcExpl_refreshTime = 100
" // Set "Enter" key to jump into the exact definition context
let g:SrcExpl_jumpKey = "<ENTER>"
" // Set "Space" key for back from the definition context
let g:SrcExpl_gobackKey = "<SPACE>"
" // In order to avoid conflicts, the Source Explorer should know what plugins
" // except itself are using buffers. And you need add their buffer names into
" // below listaccording to the command ":buffers!"
let g:SrcExpl_pluginList = [
\ "__Tag_List__",
\ "NERD_tree_1",
\ "Source_Explorer",
\ "[BufExplorer]"
\ ]
" // Enable/Disable the local definition searching, and note that this is not
" // guaranteed to work, the Source Explorer doesn't check the syntax for now.
" // It only searches for a match with the keyword according to command 'gd'
let g:SrcExpl_searchLocalDef = 1
" // Do not let the Source Explorer update the tags file when opening
let g:SrcExpl_isUpdateTags = 0
" // Use 'Exuberant Ctags' with '--sort=foldcase -R .' or '-L cscope.files' to
" // create/update the tags file
let g:SrcExpl_updateTagsCmd = "ctags --sort=foldcase -R ."
" // Set "<F12>" key for updating the tags file artificially
let g:SrcExpl_updateTagsKey = "<F12>"
" // Set "<F3>" key for displaying the previous definition in the jump list
let g:SrcExpl_prevDefKey = "<F3>"
" // Set "<F4>" key for displaying the next definition in the jump list
let g:SrcExpl_nextDefKey = "<F4>"
"====================================================
"= Tag List
"====================================================
filetype on"vim filetpye on
let Tlist_Ctags_Cmd="/usr/bin/ctags"
let Tlist_Inc_Winwidth=0
let Tlist_Exit_OnlyWindow=0
"window close=off
let Tlist_Auto_Open=0
let Tlist_Use_Right_Window=1
"====================================================
"= Project config
"====================================================
if filereadable(".project.vimrc")
source .project.vimrc
endif
"====================================================
"= NERD Tree
"====================================================
let NERDTreeWinPos="left"
let g:NERDTreeDirArrows=0
"====================================================
"= tags 설정 (cscope, ctags)
"====================================================
"Cscope의 상대경로 문제를 해결하기 위해서 매번 cscope.out파일을 새로 읽는다.
function! LoadCscope()
exe "silent cs reset"
let db = findfile("cscope.out", ".;")
if (!empty(db))
let path = strpart(db, 0, match(db, "/cscope.out$"))
set nocscopeverbose " suppress 'duplicate connection' error
exe "cs add " . db . " " . path
set cscopeverbose
endif
endfunction
au BufEnter /* call LoadCscope()
"현재 디렉토리부터 root 디렉토리까지 tags를 찾는다.
set tags=tags;/
"====================================================
"= Check Symbol
"====================================================
source ~/vimconfig/plugins/checksymbol.vim
" GUI Settings {
" GVIM- (here instead of .gvimrc)
if has('gui_running')
set guioptions-=T " Remove the toolbar
set lines=40 " 40 lines of text instead of 24
if has("gui_gtk2")
"set guifont=Andale\ Mono\ Regular\ 16,Menlo\ Regular\ 15,Consolas\ Regular\ 16,Courier\ New\ Regular\ 18
set guifont=나눔고딕코딩\ 12,Andale\ Mono\ Regular\ 16,Menlo\ Regular\ 15,Consolas\ Regular\ 16,Courier\ New\ Regular\ 18
elseif has("gui_mac")
set guifont=Andale\ Mono\ Regular:h16,Menlo\ Regular:h15,Consolas\ Regular:h16,Courier\ New\ Regular:h18 elseif has("gui_win32")
set guifont=Andale_Mono:h10,Menlo:h10,Consolas:h10,Courier_New:h10
endif
if has('gui_macvim')
set transparency=5 " Make the window slightly transparent
endif
else
if &term == 'xterm' || &term == 'screen'
set t_Co=256 " Enable 256 colors to stop the CSApprox warning and make xterm vim shine
endif
"set term=builtin_ansi " Make arrow and other keys work
endif
" }