-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
331 lines (267 loc) · 8.49 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
"let g:tex_fold_enabled=1
let fortran_free_source=1
let fortran_have_tabs=1
" automatically reread file if changed
set autoread
"splits don't resize when closing one
set noequalalways
"set ttymouse=xterm2
"
" copy&replace to mark
" (backwards requires silent)
" :silent :.,'as/arg1/arg2/
"
" copy&replace visual mouse region
" v -------- character
" V -------- line
" ctrl-v --- block
" then, s/arg1/arg2
"
" select region with mouse, works in urxvt and xterm
" copy: "*y
" paste: "*p
"
set gdefault
set linebreak
set display+=lastline
set mouse=nvicr
"set mouse=vi
set fo+=o
set ruler
set nowrap
set novisualbell
set noerrorbells
set backspace=2
set backspace=eol,start,indent
set whichwrap+=<,>,h,l,[,]
set autoindent
set smartindent
set cindent
set smarttab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set foldmethod=manual
"set foldmethod=syntax
"set nofen
set fdl=100
set wildmenu
set wildmode=list:longest,full
set wildignore=*.o,*.so,*.d,*.a,*~,*.pyc
set hlsearch
set showmatch
set smartcase
set ignorecase
set incsearch
"set scrolloff=2
set scrolloff=0
set laststatus=2
set hidden
set history=500
set viminfo=/10,'10,f0,h,"\100
"let mapleader = ","
"let g:mapleader = ","
set nomousehide
" customize grep command
set grepprg=grep\ -nH\ $*
" status line at bottom of window, above command line
set statusline=\ %F%m%r%h\ %w\ \ \ Line:\ %l/%L:%c
"set statusline=%1*%-52F\ %1*\ %Y\ %4*\ %04l/%03c\ %1*\ %-16{strftime(\"%Y-%m-%d\ %H:%M\")}\ %5*\ %-3m
" setup based upon filetype (~/.vim/(after)/ftplugin)
filetype plugin on
filetype indent on
" sometimes vim doesn't know filetypes
autocmd BufEnter *.PAS set filetype=pascal
"autocmd BufEnter *.sty,*.tex set filetype=tex
autocmd BufEnter *.gpl,*.gnuplot set filetype=gnuplot
autocmd BufEnter *.ppl,*.pyxplot set filetype=gnuplot
autocmd BufEnter *.lcsim set filetype=xml
autocmd BufEnter *.vimrc set filetype=vim
autocmd BufEnter *.groovy set filetype=java
autocmd BufEnter *.kt set filetype=java
let b:comment_leader = '#'
autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
autocmd FileType tex let b:comment_leader = '% '
autocmd FileType vim let b:comment_leader = '" '
autocmd FileType sh,bash let b:vimpipe_command="bash"
autocmd FileType perl let b:vimpipe_command="perl"
autocmd FileType python let b:vimpipe_command="python"
" cd to the buffer's directory (annoying)
"autocmd BufEnter * :cd %:p:h
" save and load ~/.vim/view for folds and such
"autocmd BufWinLeave ?* mkview
"autocmd BufWinEnter ?* silent loadview
"autocmd BufWinLeave *.fvwm2rc,*.vimrc mkview
"autocmd BufWinEnter *.fvwm2rc,*.vimrc silent loadview
" tabs in Makefiles
autocmd BufNewfile,BufRead *akefile* set noexpandtab nosmarttab
autocmd BufNewfile,BufRead *.mak set noexpandtab nosmarttab
" COLORS ----------------------------------------------
syntax on
highlight NonText cterm=NONE ctermfg=NONE
highlight Search cterm=bold ctermfg=White ctermbg=LightRed
highlight StatusLine cterm=bold ctermbg=Yellow ctermfg=Black
highlight Folded cterm=NONE ctermbg=DarkGrey ctermfg=Cyan
"colorscheme default
"colorscheme metacosm
"colorscheme rastafari
"
if &term =~ "rxvt"
set t_Co=256
" colorscheme molokai
colorscheme skittles_berry
endif
if &term =~ "xterm-256color"
set t_Co=256
colorscheme molokai
endif
"if &term =~ "rxvt-unicode"
" set t_Co=88
" colorscheme molokai
"endif
" KEY MAPPINGS ----------------------------------------
" horizontal scrolling:
map <C-ScrollWheelDown> 5zl
map <C-ScrollWheelUp> 5zh
" Y should be analagous to D:
noremap Y y$
" turn on/off search highlighting & search for word under cursor:
map <F4> :set invhls<CR>:let @/="<C-r><C-w>"<CR>/<BS>
" disable scroll left/right:
nmap <ScrollWheelRight> <nop>
nmap <ScrollWheelLeft> <nop>
"noremap j gk
"noremap k gj
"noremap j gj
"noremap k gk
"inoremap <Enter> <Enter><space><bs>
"nnoremap o o<space><bs>
"nnoremap O O<space><bs
com! Bd enew|bw # |bn
"map <F2><F3> :w<CR>
" Plugins ---------------------------------------------
" Latex-Suite -----------------------------------------
"let g:Tex_FoldedSections = 0
"let g:Tex_TexMenus = 0
" Mini-Buffer-Explorer --------------------------------
"let g:miniBufExplVSplit = 25
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
highlight def link MBENormal Normal
" TList ----------------------------------------------
"let Tlist_Compact_Format = 1
"let Tlist_Display_Prototype = 1
"hi MyTagListFileName guifg=red ctermfg=red
"hi MyTagListTagName guifg=red ctermfg=red
"let Tlist_Auto_Open = 1
" ----------------------------------------------------
" Function to open multiple files with one command
"function! Open(...)
" if (a:0 != 0)
" let i = a:0
" while(i > 0)
" execute 'let file = a:' . i
" execute 'e ' . file
" " could do a split instead:
" "execute 'sp ' . file
" let i = i -1
" endwhile
" endif
"endfunction
" filename completion for Open (* wildcard does NOT work, argh)
"com! -nargs=* -complete=file Open call Open(<f-args>)
" turn :e into :Open on vim command-line
"cab e Open
" ----------------------------------------------------
"function! CheckPythonSyntax()
" let curfile = bufname("%")
" exec ":make " . "-c " . "\"import py_compile; py_compile.compile(r'" . bufname("%") . "')\""
"endfunction
"map <F9> <ESC>:call CheckPythonSyntax()<CR>
"function! CurDir()
" let curdir = substitute(getcwd(), '/home/baltzell/', "~/", "g")
" return curdir
"endfunction
"set statusline=\ %F%m%r%h\ %w\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c
" macro shortcuts
"map :w! :!rm -f %<.dvi %<.aux /tmp/$USER-latex.log :e /tmp/$USER-latex.log :r!latex % :r!xdvi -s 0 -geometry 702x880 %<.dvi
" remove .dvi and .aux files, run latex once, and then xdvi
"map :w! :!rm -f %<.dvi %<.aux /tmp/$USER-latex.log ; latex % >& /tmp/$USER-latex.log ; xdvi -s 0 -geometry 702x880 %<.dvi >>& /tmp/$USER-latex.log &
"map :w! :!rm -f /tmp/$USER-latex.log ; latex % >& /tmp/$USER-latex.log ; xdvi +6 -s 0 %<.dvi >>& /tmp/$USER-latex.log &
" remove dvi and aux files, run latex twice, and then dvips and ghostview, and open log file
"map :w! :!rm -f %<.dvi %<.aux /tmp/$USER-latex.log ; latex % >& /tmp/$USER-latex.log ; latex % >>& /tmp/$USER-latex.log ; dvips -o%<.ps %<.dvi >>& /tmp/$USER-latex.log ; \gv %<.ps >>& /tmp/$USER-latex.log :e /tmp/$USER-latex.log
"map :w! :!rm -f %<.dvi %<.aux ; latex.sh % ; psbind %<.ps > %<2.ps
" emulate LaTexIt for OSX
"map :w! :!$HOME/scripts/texit.pl % &
" compile ROOT macro, and open log file
"map :w! :!rm -f /tmp/$USER-root.log ; echo .L %++ \| root >& /tmp/$USER-root.log :e /tmp/$USER-root.log
" compile and run ROOT, and open log file
"map :w! :!rm -f /tmp/$USER-root.log ; echo .x %++ \| root >& /tmp/$USER-root.log :e /tmp/$USER-root.log
" run ROOT macro
"map :w! :!root %
" run special script
"map :w! :!$HOME/docs/nabo/ananote/scripts/doall >& /dev/null &
"map :w! :!echo Running Latex .... ; cd .. ; ./ctex 1 >& /dev/null ; killall -s 10 xdvi-motif
"map :!cd .. ; ./ctex 1 >& /dev/null ; killall -s 10 xdvi-motif
"map :!./cdoit %< >& /dev/null &
"map :w! :!./cdoit %< >& /dev/null &
"map :w! :!../bridget.sh >& /dev/null &
"map :w! :!latex.sh % >& /dev/null &
"map :w! :!latex % >& /dev/null &
"map :w! :!gnuplot -persist % >& /dev/null&
"map :w! :!latexbibdvi.sh % >& /dev/null &
" map :w! :!./ltx >& /dev/null &
" map :w! :!./mk >& /dev/null &
"map :w! :!./cmake cv_staff >& /dev/null &
"map :w! :!texit.pl % >& /dev/null &
"map :w! :!make >& /dev/null &
"map :w! :!pdflatex % >& /dev/null &
map :w! :!pdflatex % >& /dev/null &
"map :w! :!pdflatex cv.tex >& /dev/null &
"map :w! :!pdflatex 1st_round_comments.tex >& /dev/null &
"map <F2> :set wrap!<CR>
" automatic commenting/uncommenting
" just use ctrl-v block selection if comment characters are in the same column
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
" insert templates into file:
"map 0i\begin{equation}\label{}\end{equation}
"map 0i\begin{figure}[htbp]\centering\includegraphics[]{}\caption{\label{}}\end{figure}
"map 0i\begin{table}[htbp]\centering\begin{tabular}{}\hline\end{tabular}\caption{\label{}}\end{table}
"map 0i..oo00OO00oo
"map 0i#ifndef ___%___#define ___%___