summaryrefslogtreecommitdiff
path: root/.vimrc
blob: 54313c7548f4785d0a8946d0239c3c007d6b40cc (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
" =======================================================
" GENERAL
" =======================================================

" load the bundles
source ~/.vim/bundles.vim

" Colorscheme
colorscheme Mustang

" More general stuff
set nu
set fenc=utf-8
set modeline
set ts=4
set sw=4
set sts=4
set expandtab
set guifont=Inconsolata\ Medium\ 11,Monospace\ 11
set spelllang=de_20
set guioptions-=T
set mouse=a

if has("gui_running") " nice cursorline in the gui
    set cursorline
else " explicitly disable it all else
    set nocursorline
endif

let mapleader = ","
let maplocalleader = "\\"
let &guicursor = &guicursor . ",a:blinkon0"

" disable backups
set nobackup
set nowritebackup

" statusline
set laststatus=2 " always show line

fun StatusLine()
    let ft = strlen(&ft)?&ft:"none"
    let fenc = strlen(&fenc)?&fenc:&enc."\ (G)"
    let head = fugitive#head(5)
    if strlen(head)
        let head = ",".head
    endif

    return '%-3.3n %f %r%w['
        \ .ft.','.fenc
        \ .',%{&fileformat}'
        \ .head
        \ .']%m%=%-14.(%l,%c%V%)%<%P'
endfunction

set statusline=%!StatusLine()

" Maximize window
function ToggleFullscreen()
    let cmd = ("silent !wmctrl -i -r " . v:windowid . " -b toggle,maximized_vert,maximized_horz")
    if executable("wmctrl")
        execute cmd
        if v:shell_error
            echoerr "Problem executing wmctrl"
            echoerr "Cmd:" cmd
        endif
    else
        echomsg "wmctrl not found"
    endif
endfunction

au GUIEnter * call ToggleFullscreen()

" =======================================================
" COMPLETION FOR CMDLINE
" =======================================================

" enable nice menu
set wildmenu

" do not use Left and Right for switching between completions, 
" but for cursor positioning
cnoremap <Left> <Space><BS><Left>
cnoremap <Right> <Space><BS><Right>

" =======================================================
" CUSTOM MAPPINGS
" =======================================================

" Some maps opening/closing nice windows
nmap <silent> <Leader>T :TagbarToggle<CR>
nmap <silent>  <Leader>U :GundoToggle<CR>
nmap <silent> <Leader>L <Plug>TaskList
nmap <silent> <Leader>P <Plug>ToggleProject

" others
map <C-Tab> gt
map <C-S-Tab> gT
"imap <S-Tab> <C-X><C-O>
nmap <silent> <F4> :ls<CR>:buf
nmap <Leader>t :ToggleWord<CR>

" Makes more sense and is similar to D
map Y y$

" =======================================================
" PLUGINS AND LANGUAGES
" =======================================================

" Word toggling
let g:toggle_words_dict = {
        \ 'python': [
                \ ['if', 'elif', 'else'] 
            \ ],
        \ '*': [ 
                \ ['enable', 'disable'],
                \ ['enabled', 'disabled']
            \ ]} 

" Stuff for the TagList-Plugin
let Tlist_Sort_Type = "name"
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Exit_OnlyWindow = 1

" Stuff for the NERD Tree Plugin
let NERDTreeWinPos = 0 "have it on the right site

" Autotag -- correct C++ handling
let g:autotagCtagsCmd="ctags --c++-kinds=+p --fields=+iaS --extra=+q"

" stuff for gentoo syntax
let g:bugsummary_browser="firefox %s"

" python syntax
let python_highlight_numbers = 1
let python_highlight_space_errors = 1

" default to latex for .tex files
let g:tex_flavor = "latex"
let g:Tex_DefaultTargetFormat="pdf"
let g:Tex_ViewRule_pdf = "evince"

" do not do concealment in .tex files -- just too slow (and ugly)
let g:tex_conceal = ""

" remove some unneeded stuff from vim-latex
let g:Tex_PromptedEnvironments = ""
let g:Tex_HotKeyMappings = ""
let g:Tex_EnvironmentMaps = 0 " use UltiSnips for this task
let g:Tex_FontMaps = 0
let g:Tex_SectionMaps = 0

" use pipes instead of temp files
let g:GPGUsePipes = 1

" Ultisnips
let g:UltiSnipsEditSplit = "vertical"
" vundle inserts UltiSnips BEFORE our ~/.vim
let g:UltiSnipsDontReverseSearchPath="1"


" =======================================================
" FINAL
" =======================================================

" turn of any existing search
if has("autocmd")
    au VimEnter * nohls
endif