-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvimrc
381 lines (317 loc) · 10.9 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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
au VimEnter *.clj set ft=clojure
au VimEnter *.fr set ft=haskell
au VimEnter *.scala set ft=scala
au BufRead,BufNewFile *.v set ft=coq
" enforce 8 colors
set t_Co=8
"set t_Co=256
set encoding=utf-8
set ttimeoutlen=50
set hidden
" show line numbers
set number
" always do syntaxhighlighting
syntax on
" highlight all search matches
set hlsearch
" keep indentation when opening new lines
set autoindent
" set some vi-modes
set nocompatible
" show matching brackets
set showmatch
" set width of tabs
set et
set shiftwidth=4
set tabstop=4
set nojoinspaces
" only insert real tabs at the beginning of a line and fill with spaces
" otherwise
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
"getline('.')[0:col('.')-2] =~ '^\t*$' ? "\<Tab>" : repeat(" ", &sw - ((virtcol('.')-1) % &sw))
else
return "\<c-x>\<c-o>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
"inoremap <expr> <tab> getline('.')[0:col('.')-2] =~ '^\t*$' ? "\<Tab>" : repeat(" ", &sw - ((virtcol('.')-1) % &sw))
" enable filetype specific features
filetype plugin on
" automagical omnicompletion
"set ofu=syntaxcomplete#Complete
" show a readable Beep! e.g. if finding a char via fx fails
"set debug=beep
" code folding
set foldmethod=indent
set nofoldenable
"map <C-l> zA
" show statusbar with current row,col
set modeline
let hostname = substitute(system('hostname'), '\n', '', '')
if hostname == "mephisto"
set nobackup
elseif hostname == "faui02"
set nobackup
elseif hostname == "faui03"
set nobackup
elseif hostname == "faui09"
set nobackup
else
" create backupfiles
set backup
endif
" highlight whitespaces and trailing spaces
set list
set listchars=tab:>\ ,trail:·,nbsp:_
"set listchars=tab:▸\ ,eol:¬
" menu and completion -> bash-like
set wildmenu
set wildmode=longest,list
set wildignorecase
" set visualbell t_vb=
set scrolloff=2
" ignorecase:
set ignorecase
set smartcase
" indent wrapped lines correctly:
set breakindent
set showbreak=..
if has('mouse')
set mouse=a
endif
" selecting links
nmap - <C-]>
nmap <F5> <ESC>:e<CR>
"map t <ESC>:tabnew
" line and column-numbers on bottom right
set ruler
" ignore filetypes on tab completion
set wildignore =*.o,*.class,*~
" abkürzungen
ab #i #include
ab #d #define
set foldmethod=indent
" hi folds ctermbg=0
set cursorline
set runtimepath^=~/.vim/bundle/elm.vim.git/
"set runtimepath^=~/.vim/bundle/minibufexpl/
"set runtimepath^=~/.vim/bundle/gruvbox/
"silent !~/.vim/bundle/gruvbox/gruvbox_256palette.sh &
"colorscheme gruvbox
let g:gruvbox_contrast_dark="hard"
let g:gruvbox_contrast_light="hard"
let g:gruvbox_number_column="bg3"
set background=dark
hi LineNr ctermbg=233 guibg=Black
hi Normal ctermbg=NONE term=NONE
hi VertSplit ctermbg=NONE ctermfg=black cterm=NONE
hi Visual ctermbg=black cterm=None
hi StatusLineNC ctermbg=black ctermfg=white cterm=NONE
hi StatusLine ctermbg=black ctermfg=green cterm=bold
hi CursorLine ctermbg=black term=NONE cterm=NONE
hi LineNr ctermbg=black term=NONE ctermfg=gray cterm=NONE
hi CursorLineNr ctermbg=black term=NONE ctermfg=green cterm=bold
set fillchars+=vert:│
cnoreabbrev reload source ~/.vimrc
""" " My colorscheme
""" hi Normal ctermbg=NONE term=NONE cterm=NONE
""" hi Pmenu ctermbg=black ctermfg=white term=NONE cterm=NONE
""" hi PmenuSel ctermbg=green ctermfg=0 term=NONE cterm=NONE
""" hi PmenuThumb ctermbg=red term=NONE cterm=bold
"""
""" " colors for folded brackets
""" hi Folded ctermbg=0 term=NONE cterm=NONE ctermfg=gray
""" " color of border in vertical split
""" hi VertSplit ctermbg=NONE ctermfg=black cterm=NONE
""" set fillchars+=vert:│
""" hi Todo ctermbg=yellow ctermfg=black cterm=bold
""" hi StatusLineNC ctermbg=black ctermfg=white cterm=NONE
""" hi StatusLine ctermbg=black ctermfg=yellow cterm=bold
""" " color for tabs and trailing spaces, also see: listchars
""" hi SpecialKey ctermbg=NONE ctermfg=blue cterm=NONE
""" "
""" " for tabs
""" hi TabLine ctermbg=black ctermfg=white cterm=bold
""" hi TabLineFill ctermbg=black cterm=NONE
""" hi TabLineSel ctermbg=green ctermfg=black cterm=NONE
""" " somehow, these hi lines are overwritten somewhere later
""" "hi Constant ctermfg=blue ctermbg=blue cterm=NONE
""" "hi Statement ctermfg=green ctermbg=NONE cterm=NONE
""" "hi Comment ctermfg=brown ctermbg=NONE cterm=NONE
au VimEnter *.tex :call EnterTexFile()
au VimEnter *.csv :call EnterCSVFile()
au VimEnter *.hs :call EnterHsFile()
au VimEnter /tmp/mutt* :call ComposeMessage()
au VimEnter /var/tmp/mutt* :call ComposeMessage()
au VimEnter *.tex set nocursorline
function! EnterCSVFile()
hi CSVColumnEven cterm=bold ctermbg=NONE guibg=NONE ctermfg=7
hi CSVColumnOdd cterm=NONE ctermbg=NONE guibg=NONE ctermfg=7
hi CSVColumnHeaderEven cterm=bold,underline ctermbg=NONE guibg=NONE ctermfg=3
hi CSVColumnHeaderOdd cterm=underline ctermbg=NONE guibg=NONE ctermfg=3
endfunction
function! EnterHsFile()
set et
set shiftwidth=2
set tabstop=2
endfunction
set runtimepath^=~/.vim/bundle/LaTeX-Box.git/
function! EnterTexFile()
"set keywordprg=dict
set wrap
"set ai " Auto indent
"set si " Smart indent
"set laststatus=2 " we want *always* a status bar even if I am not in splitscreen mode
"we don't because you can get filename, and stats using ctrl g
"iab newide <esc>:r ~/.vim/templates/newide<Cr>kdd
"ab xenum \begin{enumerate}<return><tab>\item<return><C-U>\end{enumerate}<up><end>
ab xenum \begin{enumerate}<return>\item<return>\end{enumerate}<up><end>
ab xitem \begin{itemize}<return>\item<return>\end{itemize}<up><end>
ab xdesc \begin{description}<return><tab>\item<return><C-U>\end{description}<up><end>
ab xdia \begin{diagram}<return>\end{diagram}<up><end>
ab xi\ \item
ab xcent \begin{center}<RETURN><RETURN><C-U>\end{center}<UP><END>
ab xalign \begin{align*}\end{align*}<LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><RETURN><UP><END>
ab xals \begin{align*}<RETURN><C-U>\end{align*}<UP><END>
ab xma \[\]<LEFT><LEFT><RETURN><UP><END>
ab xtcd \begin{tikzcd}\end{tikzcd}<LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><LEFT><RETURN><UP><END>
ab xsec \section{}<left>
ab xsub \subsection{}<left>
ab xssub \subsubsection{}<left>
ab xframe \begin{frame}{}<RETURN><TAB><RETURN><C-U>\end{frame}<UP><UP><END><LEFT>
ab xblock \begin{block}{}<RETURN><TAB><RETURN><C-U>\end{block}<UP><UP><END><LEFT>
ab xablock \begin{alertblock}{}<RETURN><TAB><RETURN><C-U>\end{alertblock}<UP><UP><END><LEFT>
ab xlst \lstinputblock{}<LEFT>
ab dt \d t
let g:LatexBox_split_type="new"
set nocul
endfunction
function! ComposeMessage()
set spell
iab cu Gruß,<CR>Thorsten
iab cuv Viele Grüße,<CR>Thorsten
iab cuw Viele Grüße,<CR>Thorsten Wißmann
iab xbest Best,<CR>Thorsten
iab xwe Schönes Wochenende,<CR>Thorsten
iab xsprech http://wwwcip.cs.fau.de/admin/index.html.en
iab xfaq http://wwwcip.cs.fau.de/doc/faq.html.en
iab xtofu -- <CR>A. Because it breaks the logical sequence of discussion<RETURN>Q. Why is top posting bad?
endfunction
au FileType clojure filetype plugin indent on
au FileType clojure :call EditClojure()
function! EditClojure()
syntax on
set autoindent
set tabstop=2
set shiftwidth=2
let g:vimclojure#ParenRainbow = 1
" nailgun
let vimclojure#WantNailgun = 1
let vimclojure#NailgunServer = "127.0.0.1"
let vimclojure#NailgunPort = "2113"
" buffer
let vimclojure#SplitPos = "left"
let vimclojure#SplitSize = 10
vmap <C-c><C-c> "ry :call Send_to_Screen(@r)<CR>
nmap <C-c><C-c> vip<C-c><C-c>
let g:screen_sessionname = "clj"
let g:screen_windowname = "clj"
nmap <C-c>v :call Screen_Vars()<CR>
endfunction
function! Screen_Vars()
if !exists("g:screen_sessionname") || !exists("g:screen_windowname")
let g:screen_sessionname = ""
let g:screen_windowname = "0"
end
let g:screen_sessionname = input("session name: ", "", "custom,Screen_Session_Names")
let g:screen_windowname = input("window name: ", g:screen_windowname)
endfunction
function! Send_to_Screen(text)
echo system("screen -S clj -p clj -X stuff '" . substitute(a:text, "'", "'\\\\''", 'g') . "'")
endfunction
" Spell Check
let b:myLang=0
let g:myLangList=["nospell","de_de","en_gb", "nl"]
function! ToggleSpell()
let b:myLang=b:myLang+1
if b:myLang>=len(g:myLangList) | let b:myLang=0 | endif
if b:myLang==0
setlocal nospell
else
execute "setlocal spell spelllang=".get(g:myLangList, b:myLang)
endif
echo "spell checking language:" g:myLangList[b:myLang]
endfunction
map <F7> :call ToggleSpell()<CR>
imap <F7> <ESC>:call ToggleSpell()<CR>a
" minibufexplorer options
"map <F9> :MBEToggle<CR>
"map <C-J> :bn<CR>
"map <C-K> :bp<CR>
"
"let g:miniBufExplStatusLineText = "MiniBufExpl"
"let g:miniBufExplVSplit = 1
"let g:miniBufExplMinSize = 10
"let g:miniBufExplMaxSize = 50
"let g:miniBufExplShowBufNumbers = 1
"
"hi MBENormal ctermbg=None term=None cterm=None ctermfg=Gray
"hi MBEChanged ctermbg=None term=None cterm=None ctermfg=DarkYellow
"hi MBEVisibleNormal ctermbg=None term=None cterm=None ctermfg=DarkGreen
"hi MBEVisibleChanged ctermbg=None term=None cterm=None ctermfg=DarkGreen
"hi def link MBEVisibleActiveNormal None
if has("autocmd")
augroup GPGASCII
au!
au BufReadPre *.gpg set viminfo=
au BufReadPre *.gpg set noswapfile
au BufReadPost *.gpg :%!gpg -q -d 2> /dev/null
au BufReadPost *.gpg |redraw
au BufWritePre *.gpg :%!gpg -q -e -a -r 1caff810
au BufWritePre *.gpg let @f=expand("%:t")
au BufWritePre *.gpg 1 s/^/\=@f ."\r\r"/
au BufWritePost *.gpg u
augroup END
endif " has ("autocmd")
" vimpager
" --------
let vimpager_passthrough = 0
if exists("vimpager")
"let vimpager_scrolloff = 0
"let g:less_enabled=0
set nonu
call <SNR>1_End()
endif
au VimEnter *.tex execute "nmap ZE :! VIM_KEY='ZE' synctex-katarakt-vim " . v:servername . " 2>/dev/null >/dev/null &<LEFT><LEFT>"
" CTRLP configuration
set runtimepath^=~/.vim/bundle/ctrlp.vim
nmap <C-O> :CtrlPBuffer<CR>
hi CtrlPMode1 cterm=bold ctermfg=blue ctermbg=black guibg=black
hi CtrlPMode2 cterm=bold ctermfg=red ctermbg=black guibg=black
hi CtrlPStatus cterm=bold ctermfg=yellow ctermbg=black guibg=black
let g:ctrlp_match_window = 'bottom,order:btt,min:2,max:20'
let g:ctrlp_switch_buffer = '0'
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
noremap <buffer> <silent> k gk
noremap <buffer> <silent> j gj
" some spacemacs keys
noremap <space>w <C-w>
map <space>bp :bp<CR>
map <space>bn :bn<CR>
set clipboard=unnamedplus
set showcmd
let b:ale_linters = ['flake8', 'pylint']
" let g:ale_enabled = 0
" Plug 'w0rp/ale', { 'on': 'ALEToggle' }
" Use OmniCompletion for abook dictionary entries
" Fire omnicompletion using ^X^O
au BufRead /tmp/mutt* setlocal omnifunc=QueryCommandComplete
" Suppress flake8 warnings:
" * E123: closing bracket indentation (weird recommendation, tbh)
" * E128: deep visual indentations (subverts the point of linebreaks)
" * E501: line too long
" * ...
let g:ale_python_flake8_options='--ignore=E123,E128,E501'