-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gvimrc
More file actions
executable file
·257 lines (217 loc) · 6.35 KB
/
Copy path.gvimrc
File metadata and controls
executable file
·257 lines (217 loc) · 6.35 KB
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
set guifont=Monospace\ 13
"in order to assure f status
set cpoptions=aABceFs
colorscheme elflord
set lines=45 columns=80
" replace tabs with space
set et
"window size always equal for multiple windows
set ea
set nobackup
"make backspace work
set bs=2
set guioptions-=T
set tw=0
set ic
"cscope abbrevation
"set scs
set ruler
"incremental serach
set is
"set vb
"set sm
"set ts=4
set smartindent
set shiftwidth=4
"scroll off
set so=5
set smarttab
inoremap <S-Tab> <C-V><Tab>
"enable syntax for c
syntax enable
" enable background highlighting
set hlsearch
" hide the mouse when typing text
set mousehide
" ignore in autocomplete
set wildignore=*.o,*.dep,*.ko,*.bak,*.swp
" enable auto-wrapping of text (not only comments)
set formatoptions+=t
" use GNU c syntax highlights
let c_gnu=1
source ~/cscope_maps.vim
"highlight wasted spaces
let c_space_errors=1
"highlight long lines
au FileType text setlocal textwidth=80
"paste using mouse
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
au BufNewFile,BufRead *.c.*.tmp setf c
au BufNewFile,BufRead *.h.*.tmp setf c
au BufNewFile,BufRead *.mak.*.tmp setf make
au BufNewFile,BufRead Makefile.*.tmp setf make
set guicursor=n-v-c:block-Cursor/lCursor-blinkwait528-blinkoff0-blinkon1144,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor-blinkwait528-blinkoff0-blinkon1144,r-cr:hor20-Cursor/lCursor,sm:block-Cursor
" Remove "# needreview" instances (with confirmation)
:nmap <F2> :%s/needreview//gc<CR>
if &diff
set winwidth=82
hi DiffAdd term=bold ctermbg=blue
hi DiffChange term=bold ctermbg=green guifg=red guibg=lightGray
hi DiffDelete term=bold cterm=bold ctermfg=4 ctermbg=6 gui=bold guifg=lightGray guibg=DarkGray
hi DiffText term=reverse cterm=bold ctermbg=1 gui=bold guibg=DarkGray guifg=purple
map <SPACE> ]czz
map <A-x> ]czz
map <A-z> [czz
map <s-SPACE> [czz
map <silent> <f2> :set diffopt^=iwhite<cr>
map <silent> <s-f2> :set diffopt-=iwhite<cr>
map <silent> <a-d> :set diff!<cr>
map yu <esc>:diffget<cr>
map yt <esc>:diffup<cr>
cnoreab q qa
cnoreab qq q
cnoreab x xa
cnoreab xx x
if $COMMIT == 1
colorscheme peachpuff
endif
set go-=rRlL dip=filler,context:5000
set lsp=3 co=159 noea
endif
"to change the DirDiff options
let g:DirDiffSort = 1
let g:DirDiffIgnore = "ld;Revision;Date"
let g:DirDiffExcludes = "CVS,*.class,*.exe,*.swp,*.o"
function! IsTokenChar(is_fname, char)
if a:char == "_"
return 1
endif
if a:char >= "0" && a:char <= "9"
return 1
endif
if a:char >= "A" && a:char <= "Z"
return 1
endif
if a:char >= "a" && a:char <= "z"
return 1
endif
if a:is_fname && a:char == "/"
return 1
endif
if a:is_fname && a:char == "."
return 1
endif
if a:is_fname && a:char == "-"
return 1
endif
return 0
endfunction
function! TokenUnderCursor(is_fname)
let line = getline(".")
let pos = col(".") - 1
let begpos = pos - 1
while IsTokenChar(a:is_fname, strpart(line, begpos, 1)) == 1
let begpos = begpos - 1
endwhile
let endpos = pos + 1
while IsTokenChar(a:is_fname, strpart(line, endpos, 1)) == 1
let endpos = endpos + 1
endwhile
return strpart(line, begpos+1, endpos-begpos-1)
endfunction
function Jbugz()
if &modified
" TODO: consider warning the caller
echo "Saving buffer before doing CVS Ann"
exe ":w"
endif
let cmd="bugz show " . TokenUnderCursor(1) . " -f -t"
let out=system(cmd)
" TODO: try to edit a new temp file
:ene
silent 0put=out
set buftype=nofile
set filetype=bugz
endfunction
function! PutDebugLine(lvl)
if a:lvl==1
let dlvl="_E"
elseif a:lvl==2
let dlvl="_W"
elseif a:lvl==3
let dlvl="_I"
elseif a:lvl==4
let dlvl="_V"
elseif a:lvl==5
let dlvl="_X"
endif
exe 'norm! aDBG'.dlvl.'(, ("%s: \n", FNAME));'
endfunction
map <F1> ma :execute ':!cvsdiff' TokenUnderCursor(1) <CR><CR>
" add debug lines (DBG_)
au BufNewFile,BufRead *.c map debug1 :call PutDebugLine(1)<cr>==wli
"au BufNewFile,BufRead *.c imap debug1 <c-o>:call PutDebugLine(1)<cr><esc>==wli
au BufNewFile,BufRead *.c map debug2 :call PutDebugLine(2)<cr>==wli
"au BufNewFile,BufRead *.c imap debug2 <c-o>:call PutDebugLine(2)<cr><esc>==wli
au BufNewFile,BufRead *.c map debug3 :call PutDebugLine(3)<cr>==wli
"au BufNewFile,BufRead *.c imap debug3 <c-o>:call PutDebugLine(3)<cr><esc>==wli
au BufNewFile,BufRead *.c map debug4 :call PutDebugLine(4)<cr>==wli
"au BufNewFile,BufRead *.c imap debug4 <c-o>:call PutDebugLine(4)<cr><esc>==wli
au BufNewFile,BufRead *.c map debug5 :call PutDebugLine(5)<cr>==wli
"au BufNewFile,BufRead *.c imap debug5 <c-o>:call PutDebugLine(5)<cr><esc>==wli
map <F3> :call Jbugz()<CR>
map <F8> :call Browser()<CR>
map <silent> <f12> :TlistToggle<cr>
"open buffers and choose the buffer you want
map bb :buffers<CR>:b
"copy cut paste like windows
map <C-c> yw
map <C-v> pw
map <C-x> dw
"increase/decrease font
nmap <F11> :silent! let &guifont = substitute(&guifont, ':h\zs\d\+', '\=eval(submatch(0) - 1)', '')<CR>
nmap <S-F11> :silent! let &guifont = substitute(&guifont, ':h\zs\d\+', '\=eval(submatch(0) + 1)', '')<CR>
function! MySwapUp()
if ( line(".") > 1 )
let cur_col = virtcol(".") - 1
if ( line(".") == line("$") )
normal ddP
else
normal ddkP
endif
execute "normal " . cur_col . "|"
endif
endfunction
function! MySwapDown()
if ( line(".") < line("$") )
let cur_col = virtcol(".")
normal ddp
execute "normal " . cur_col . "|"
endif
endfunction
function! MySwapRight()
if ( col(".") < col("$") - 1 )
normal xp
endif
endfunction
function! MySwapLeft()
if ( col(".") > 1 )
if ( col(".") < col("$") - 1 )
normal xhP
else
normal xP
endif
endif
endfunction
" swap char right
noremap <silent> <c-a-right> :call MySwapRight()<cr>
" swap char left
noremap <silent> <c-a-left> :call MySwapLeft()<cr>
" swap line up
noremap <silent> <c-up> :call MySwapUp()<cr>
" swap line down
noremap <silent> <c-down> :call MySwapDown()<cr>
"change settings for linux kernel coding
nmap linux <ESC>:set noexpandtab<CR>:set shiftwidth=8<CR>
au FileType make setlocal nosmarttab | setlocal noexpandtab