aboutsummaryrefslogtreecommitdiff
path: root/vimrc
blob: ea96df4696542dfc9d636969bf426f059d82a111 (plain)
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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
call pathogen#infect() 
" Pathogen

filetype plugin indent on
set omnifunc=syntaxcomplete#Complete

" conceal displays LaTeX formulars inline with UTF8
set conceallevel=0 " 1,2 to enable it
set concealcursor=

set linebreak

"set wrap
set nowrap

set noswapfile
"set noundofile
"set nobackup
"set nowritebackup
set backupdir=~/.vim/temp
set directory=~/.vim/temp
set undodir=~/.vim/temp

" [code completion]
set completeopt=longest,menuone

" [spell checker]
"set spell " enable spell checking
set spelllang=en,de

set guifont=DejaVu\ Sans\ Mono\ bold\ 11
"set guifont=Liberation\ Mono\ for\ Powerline\ 11



" [Kopieren und Einfuegen]
" verwendet das x-window-clipboard <3
set clipboard=unnamedplus
"set clipboard=autoselectplus


" [SUCHEN]
" When 'ignorecase' and 'smartcase' are both on, if a pattern contains an uppercase letter, it is case sensitive, otherwise, it is not. For example, /The would find only "The", while /the would find "the" or "The" etc. 
set ignorecase
set smartcase

" [VIEW]
syntax on


" machen, dass der befehl wie z.B. " a p  fuer register a
set showcmd
set number

set guioptions+=m  "show menu bar
set guioptions-=T  "remove toolbar
set guioptions+=r  "show right-hand scroll bar
set guioptions-=c  "use console dialogs instead of popups
set guioptions+=a  "autoselect: copy&paste using middleclick
set guioptions+=e  "add tab pages
set guioptions+=p  "use gui pointer callback for x11 


" ohne den naechsten eintrag verschwindet die powerline manchmal...
set laststatus=2

" set width for indentation
"set tabstop=2
"set softtabstop=2
"set shiftwidth=2
" replace tabstop by space
"set expandtab

" same in short...
set ts=2 sts=2 sw=2 expandtab 


let $PAGER=''

"set <S-Up>=^[[1;2A <S-Down>=^[[1;2B <S-Right>=^[[1;2C <S-Left>=^[[1;2D
"set <F13>=^[[24~
"map <F13> <S-Down>
"nnoremap <F13> :test
"set <F13>=^[9;0011
" map <F13> <xF1>

" q: ist der befehlseditor, damit kann man befehle kopieren in den textblock"
" q/ ist die history fuer die letzten suchen
"
" au=auto command, vimenter=event, *=filetype, NERDTree=command
" au vimenter * NERDTree

"nnoremap <Tab> :tabnext
"nnoremap <S-Tab> :tabpreviews

"nnoremap <C-Tab> :bnext<CR>
"nnoremap <C-S-Tab> :bprevious<CR>

"nnoremap <C-Tab> <C-PageDown>
"nnoremap <C-S-Tab> <C-PageUp>
"
nnoremap <C-Tab> :tabnext<CR>
nnoremap <C-S-Tab> :tabprevious<CR>
" do not display full path as tabname
set guitablabel=%t

"nnoremap <C-Tab> :bnext<CR>
"nnoremap <C-S-Tab> :bprevious<CR>

"nnoremap <C-Space> :call s:LaunchCompletion()
"inoremap <C-space> <C-x><C-o><C-p>
nnoremap <C-space> <C-n><C-n><C-p>
"inoremap <C-Space> <C-x><C-o>
inoremap <C-Space> <C-n>
"inoremap <C-@> <C-Space>
" open omni completion menu closing previous if open and opening new menu without changing the text
"
" simulate CTRL+C
vnoremap <C-c> y
"vnoremap <C-x> d
"noremap <C-v> gP " interfers with VISUAL BLOCK mode

" activate visual mode in normal mode
"map <S-Up> V
":map <S-Down> V
" these are mapped in visual mode
"map <S-Up> k
"map <S-Down> j
" increase/decrease indent in visual mode by tab and shift-tab
vmap <Tab> >gv
vmap <S-Tab> <gv

" make arrow keys work in visual mode
vmap <Esc>OA k
vmap <Esc>OB j
vmap <Esc>OC l
vmap <Esc>OD h
" map shift-right to visually select and so on
nnoremap <C-Right> El
nnoremap <S-Right> vl
nnoremap <S-Left> vj
nnoremap <S-Up> vk
nnoremap <S-Down> vj

" quickfix list (lists errors and warnings)
" nnoremap <F5> :cw<CR>
nnoremap <F5> :call ToggleQuickfixList()<CR>


"nnoremap <Tab> :MBEbf<CR>
"nnoremap <S-Tab> :MBEbb<CR>
nnoremap <Tab> <C-w>w
nnoremap <S-Tab> <C-w>W


" nnoremap <C-w> :q<CR>
noremap! <C-s> <ESC>:w<CR>

"nnoremap <C-]> :PREVCOLOR<CR>
nnoremap <C-K> :NEXTCOLOR<CR>


nnoremap <Home> ^
vmap <Home> ^

nnoremap <End> $
vmap <End> $

nnoremap <Leader> \

" nnoremap <C-o> :NERDTreeToggle<CR>
nnoremap <C-o> :browse e<CR>
let NERDTreeShowHidden=1
let NERDTreeQuiToNopen=1
let NERDChristmasTree=1
let NERDTreeMinimalUI=1
let NERDTreeWinSize = 40
let NERDTreeMapToggleHidden='\h'

" --------------------------------------------------------------------
let g:airline_left_sep = '▶'
let g:airline_right_sep = '◀'
"let g:airline_theme = 'powerlineish'
"let g:airline_theme = 'tomorrow'
let g:airline_theme = 'light'
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
  let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"


let g:miniBufExplAutoStart = 1
"let g:miniBufExplVSplit = 20   " column width in chars
"let g:miniBufExplBRSplit = 1   " Put new window below
let g:miniBufExplShowBufNumbers = 0
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplCycleArround = 1
  let g:miniBufExplMapWindowNavVim = 1
  let g:miniBufExplMapWindowNavArrows = 1
  let g:miniBufExplMapCTabSwitchBufs = 1
  let g:miniBufExplModSelTarget = 1
" MiniBufExpl Colors
hi MBENormal               guifg=fg guibg=bg
hi MBEChanged              guifg=red guibg=bg
hi MBEVisibleNormal        guifg=bg guibg=fg
hi MBEVisibleChanged       guifg=bg guibg=FG
hi MBEVisibleActiveNormal  guifg=bg guibg=fg
hi MBEVisibleActiveChanged guifg=bg guibg=fg


if v:version >= 700
  au BufLeave * let b:winview = winsaveview()
  au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif
endif

" function! PlaySound()
"  silent! exec '!play ~/.vim/support/tape.aiff &'
" endfunction
"autocmd CursorMovedI * call PlaySound()


set nocompatible
set modeline
set modelines=3
" vim: syntax=vim
"
"
"
" clang_autocomplete options


let g:clang_use_library=1
"let g:clang_library_path='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib'
let g:clang_auto_select=0
let g:clang_complete_auto=1 " automatically complete after ->, ., ::
let g:clang_periodic_quickfix=1
let g:clang_close_preview=1 " If equal to 1, the preview window will be close automatically after a completion
"let g:clang_snippets=1
"let g:clang_conceal_snippets=1
"let g:clang_snippets_engine='clang_complete'
"let g:clang_complete_macros=1
"let g:clang_complete_patterns=1
"let g:clang_close_preview=1

" Show clang errors in the quickfix window
"let g:clang_complete_copen = 1
"
"
let g:clang_user_options='|| exit 0'
let g:clang_sort_algo="alpha"



" muss am ende stehen, macht das INSERT nicht angezeigt wird. macht ja airline
" auch schon.
set noshowmode " hide --INSERT-- from command line (as its already shown in airline)
set cursorline " highlight currently selected line

set wildmenu " displays command options in status line / airline when pressing TAB
set wildmode=longest:full,full

set scrolloff=2 " always keep at least two lines visible (when seeking)

"noremap help vert help
cabbrev help tab help
"autocmd FileType help,* wincmd L

"autocmd BufNew * if winnr('$') == 1 | tab sball | endif
"autocmd BufReadPost * tab ball
map ,e :e <C-R>=expand("%:p:h") . "/" <CR> 

" If wanted, auto commenting can be disabled for all files with: 
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o

colorscheme maxvb6
if has("gui_running")
  "colorscheme Tomorrow-Night-Blue
  "colorscheme bclear
else
  " use 256 colors in Console mode if we think the terminal supports it 
  if &term =~? 'mlterm\|xterm\|screen' 
    set t_Co=256
  endif
    "set t_Co=256
    "set t_AB=^[[48;5;%dm
    "set t_AF=^[[38;5;%dm
    "set term=ansi
    "colorscheme ibmedit
    "colorscheme h80
    "colorscheme greyhouse
    "colorscheme tango-morning
    "colorscheme jhlight
    "colorscheme newspaper
    "colorscheme relaxedgreen
    let g:airline_theme = 'hybrid'
    "highlight LineNr ctermfg=grey ctermbg=black
endif


" ex command for toggling hex mode - define mapping if desired
command -bar Hexmode call ToggleHex()

" helper function to toggle hex mode
function ToggleHex()
  " hex mode should be considered a read-only operation
  " save values for modified and read-only for restoration later,
  " and clear the read-only flag for now
  let l:modified=&mod
  let l:oldreadonly=&readonly
  let &readonly=0
  let l:oldmodifiable=&modifiable
  let &modifiable=1
  if !exists("b:editHex") || !b:editHex
    " save old options
    let b:oldft=&ft
    let b:oldbin=&bin
    " set new options
    setlocal binary " make sure it overrides any textwidth, etc.
    let &ft="xxd"
    " set status
    let b:editHex=1
    " switch to hex editor
    %!xxd
  else
    " restore old options
    let &ft=b:oldft
    if !b:oldbin
      setlocal nobinary
    endif
    " set status
    let b:editHex=0
    " return to normal editing
    %!xxd -r
  endif
  " restore values for modified and read only state
  let &mod=l:modified
  let &readonly=l:oldreadonly
  let &modifiable=l:oldmodifiable
endfunction


" Show syntax highlighting groups for word under cursor
map <C-S-P> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
      \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
      \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>


" Append modeline after last line in buffer using \ml
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX
" files. 
function! AppendModeline()
  let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :",
        \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
  let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
  call append(line("$"), l:modeline)
endfunction
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>


" make vimdiff ignore white spaces
set diffopt+=iwhite
set diffopt+=filler
set diffexpr=""
set nocompatible


set diffopt+=iwhite


set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500
highlight Cursor guifg=black guibg=lightgreen



set virtualedit=onemore
" damit das highlight der klammern nicht genauso aussieht wie der cursor
hi MatchParen cterm=none ctermbg=yellow ctermfg=yellow


" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2014 Nov 05
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set backup		" keep a backup file (restore to previous version)
  set undofile		" keep an undo file (undo changes after closing)
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
map Q gq

" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
  set mouse=a
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  " Also don't do it when the mark is in the first line, that is the default
  " position when opening a file.
  autocmd BufReadPost *
    \ if line("'\"") > 1 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif

  augroup END

else

  set autoindent		" always set autoindenting on

endif " has("autocmd")

" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
		  \ | wincmd p | diffthis
endif

if has('langmap') && exists('+langnoremap')
  " Prevent that the langmap option applies to characters that result from a
  " mapping.  If unset (default), this may break plugins (but it's backward
  " compatible).
  set langnoremap
endif


































" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2014 Nov 05
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set backup		" keep a backup file (restore to previous version)
  set undofile		" keep an undo file (undo changes after closing)
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
map Q gq

" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
  set mouse=a
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  " Also don't do it when the mark is in the first line, that is the default
  " position when opening a file.
  autocmd BufReadPost *
    \ if line("'\"") > 1 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif

  augroup END

else

  set autoindent		" always set autoindenting on

endif " has("autocmd")

" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
		  \ | wincmd p | diffthis
endif

if has('langmap') && exists('+langnoremap')
  " Prevent that the langmap option applies to characters that result from a
  " mapping.  If unset (default), this may break plugins (but it's backward
  " compatible).
  set langnoremap
endif
..