-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
364 lines (283 loc) · 10.1 KB
/
vimrc
File metadata and controls
364 lines (283 loc) · 10.1 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
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
" _________ _______
"|\ /|\__ __/( )
"| ) ( | ) ( | () () |
"| | | | | | | || || |
"( ( ) ) | | | |(_)| |
" \ \_/ / | | | | | |
" \ / ___) (___| ) ( |
" \_/ \_______/|/ \|
" General settings set encoding=utf-8
set fileencoding=utf-8
" Filetype
filetype on
filetype plugin on
"filetype indent on
" Plugins {{{
" --------------------
call plug#begin('~/.vim/plugged')
" Integration
Plug 'scrooloose/nerdtree' " File Explorer
Plug 'scrooloose/nerdcommenter' " NerdCommenter, comment stuff with style
Plug 'vim-scripts/TaskList.vim' " Tasklist collects all TODO, FIXME and XXX in a handy list.
Plug 'vim-scripts/taglist.vim' " Taglist gives an overview of source code (functions, ...)
Plug 'suan/vim-instant-markdown' " Instant markdown preview
Plug 'rking/ag.vim' " ag adcanced searching utility
" Completion
"Plug 'ervandew/supertab' " Allows <Tab> completion for YCM as well as Ultisnip
Plug 'Valloric/YouCompleteMe' " Auto completion
Plug 'SirVer/ultisnips' " Ultisnips suggests snips by entry.
Plug 'honza/vim-snippets' " Snippets are seperate from ultisnips
" Code Display
Plug 'bronson/vim-trailing-whitespace' " Fix Whitespaces
Plug 'junegunn/vim-easy-align' " Easy Align - select position, RETURN, line, SPACE
Plug 'ap/vim-css-color' " Preview colors in source code while editing.
Plug 'elzr/vim-json' " prettify JSON
Plug 'ehamberg/vim-cute-python' " display unicode characters for python operators
" Language
Plug 'scrooloose/syntastic' " syntax checker
Plug 'kchmck/vim-coffee-script' " Adds CoffeeScript support to vim
Plug 'lervag/vimtex' " Latex editor
Plug 'bkad/CamelCaseMotion' " Adds CamelCase movement to vim
" GIT
Plug 'airblade/vim-gitgutter' " GIT
Plug 'tpope/vim-fugitive'
" Style
" not used
" Plug 'weynhamz/vim-plugin-minibufexpl' " MinibufExpl makes buffers accessible to every new window in vim
" Plug 'hallettj/jslint.vim' " JSlint for vim
" Plug 'lervag/vimtex'
" Plug 'tmux-plugins/vim-tmux' " Proper syntax highlightning for tmux.conf
" Plug 'Shougo/vimproc.vim' " Unite depends on vimproc
" Plug 'Shougo/unite.vim' " File explorer
" Plug 'majutsushi/tagbar' " Tagbar, list tags, methods, variables,...
" Plug 'vim-scripts/simple-pairs' " Simple-Paris, adds closing parenthesis, brackets, ...
" Plug 'wincent/command-t' " Command-T, extremly fast opening of files and stuff
" Plug 'powerline/powerline' " Powerline
call plug#end()
" ----------------
" End of Plugins }}}
" Plugin config {{{
" ----------------
" Easy align interactive
"""
vnoremap <silent> <Enter> :EasyAlign<cr>
" Syntastic
let g:syntastic_javascript_closurecompiler_path = '~/.vim/closure-compiler/compiler.jar' " JS Validator
" let g:syntastic_html_checkers = ['w3'] " HTML Validator
let g:syntastic_tex_chktex_showmsgs = 1
" Disable some Ruby warnings
let g:syntastic_eruby_ruby_quiet_messages =
\ {'regex': 'possibly useless use of a variable in void context'}
" Disable some warnings
let g:syntastic_quiet_messages =
\ {'regex': 'possible unwanted space at \"{\"'}
" NERDTree
map <C-n> :NERDTreeToggle<CR>
" Word Count with no Latex Markup and stuff
:map <F3> :w !detex \| wc -w<CR>
"" Completion
""""
" YouCompleteMe
" https://github.com/Valloric/YouCompleteMe.
let g:ycm_key_list_select_completion = ['<TAB>', '<Down>']
let g:ycm_key_list_previous_completion = ['<S-TAB>', '<Up>']
" Python completion
let g:ycm_python_binary_path = '/usr/bin/python3'
"" UltiSnips
" Snippets can be found here:
" https://github.com/honza/vim-snippets
let g:UltiSnipsSnippetsDir = $HOME.'/.vim/plugged/vim-snippets/UltiSnips/'
let g:UltiSnipsSnippetDirectories = ["UltiSnips"]
let g:UltiSnipsEditSplit = "vertical"
let g:UltiSnipsExpandTrigger="<C-k>"
let g:UltiSnipsJumpForwardTrigger="<M-j>"
let g:UltiSnipsJumpBackwardTrigger="<M-k>"
"" Vimtex
""""
let g:tex_flavor='latex'
let g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*'
let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_MultipleCompileFormats='pdf,bib,pdf'
"" Vimtex completion with YCM
""""
if !exists('g:ycm_semantic_triggers')
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers.tex = [
\ 're!\\[A-Za-z]*cite[A-Za-z]*(\[[^]]*\]){0,2}{[^}]*',
\ 're!\\[A-Za-z]*ref({[^}]*|range{([^,{}]*(}{)?))',
\ 're!\\hyperref\[[^]]*',
\ 're!\\includegraphics\*?(\[[^]]*\]){0,2}{[^}]*',
\ 're!\\(include(only)?|input){[^}]*',
\ 're!\\\a*(gls|Gls|GLS)(pl)?\a*(\s*\[[^]]*\]){0,2}\s*\{[^}]*',
\ 're!\\includepdf(\s*\[[^]]*\])?\s*\{[^}]*',
\ 're!\\includestandalone(\s*\[[^]]*\])?\s*\{[^}]*',
\ ]
"" CamelCaseMotion
""""
map <silent> ,w <Plug>CamelCaseMotion_w
map <silent> ,b <Plug>CamelCaseMotion_b
map <silent> ,e <Plug>CamelCaseMotion_e
map <silent> ,ge <Plug>CamelCaseMotion_ge
omap <silent> ,iw <Plug>CamelCaseMotion_iw
xmap <silent> ,iw <Plug>CamelCaseMotion_iw
omap <silent> ,ib <Plug>CamelCaseMotion_ib
xmap <silent> ,ib <Plug>CamelCaseMotion_ib
omap <silent> ,ie <Plug>CamelCaseMotion_ie
xmap <silent> ,ie <Plug>CamelCaseMotion_ie
"" Instant Markdown
""""
" Disable autostart of instant markdown when .md file is opened.
" Enables :InstantMarkdownPreview command in vim.
let g:instant_markdown_autostart = 0
" --------------
" End of personal config }}}
" Keybindings {{{
" --------------------
" make backspace work like most other apps
set backspace=2
" --------------------
" Moving lines
" --------------------
execute "set <M-J>=\eJ"
execute "set <M-K>=\eK"
" Normal mode
nnoremap <M-J> :m .+1<CR>==
nnoremap <M-K> :m .-2<CR>==
" Insert Mode
inoremap <M-J> <Esc>:m .+1<CR>==gi
inoremap <M-K> <Esc>:m .-2<CR>==gi
" Visual mode
vnoremap <M-J> :m '>+1<CR>gv=gv
vnoremap <M-K> :m '<-2<CR>gv=gv
" --------------------
" Navigation through tabs
" --------------------
execute "set <M-}>=\e}"
execute "set <M-{>=\e{"
map <M-{> gT
map <M-}> gt
" --------------------
" END of Keybindings }}}
" Style related stuff {{{
" --------------------
" enables syntax highlightning
syntax enable
" Always display the status line
set laststatus=2
" Set line numbers
set number
" display ruler on the bottom left corner
" displays line numer, column number, virtual column number and relative
" position of the cursor
set ruler
" set colorscheme
colorscheme onedark
set background=dark
" Setup line length marker at 80 characters
if (exists('+colorcolumn'))
set colorcolumn=80
highlight ColorColumn ctermbg=darkgray
endif
" Highlightning of the current line
set cursorline " highlight current line
" hi CursorLine term=none cterm=none ctermbg=4 " adjust coloset cul
" Display unprintable chars
set list
set listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:␣
set showbreak=↪
" --------------------
" END of Style related stuff }}}
" Identing and Tabs {{{
" --------------------
set autoindent
set paste
" insert spaces instead of tabs
set softtabstop=4
set shiftwidth=4
set expandtab
" --------------------
" End of Identing }}}
" Search {{{
" --------------------
set hlsearch " highlight all search pattern matches
set incsearch " start searching as soon as you type the first character
" With ignorecase + smartcase a pattern is only case sensitive, if it contains
" an uppercase letter.
set ignorecase
set smartcase
" --------------------
" END of Search }}}
" Usability {{{
" --------------------
" Show maching brackets
set showmatch
" enable use of {{{ and }}} to mark foldings in code
set foldmethod=marker
"Auto cd in directory of the current file
set autochdir
" Disable auto commenting
autocmd FileType * setlocal formatoptions-=r formatoptions-=o
"This shows what you are typing as a command
set showcmd
" set history limit
set history=300
" Keeping Backups and tmp files in one place
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set undodir=~/.vim/backup/undos
set undofile
set bk
"Commandline completion
"ex: :color <Tab>
"will expand the command line vertically and list completion suggestions
set wildmenu
set wildmode=list:longest,full
"Enable mouse support
set mouse=a
"Remove the buffer, after closing tab
set nohidden
"Open URL in browser
function! Browser()
let line = getline (".")
let line = matchstr (line, "http[^ ]*")
exec "!chromium".line
endfunction
" --------------------
" END of Usability }}}
" Remap keys {{{
" --------------------
" Map 'W' on saving an already opened file without privileges
command W :execute ':silent w !sudo tee % > /dev/null' | :edit!
"Remap jj to escape in insert mode.
inoremap jj <ESC>
nnoremap JJJJ <Nop>
" Copy with STRG + C
vnoremap <C-c> "*y
" insert with STRG + V
imap <c-v> <C-r><C-p>+
" increasing and decreasing numbers
function! AddSubtract(char, back)
let pattern = &nrformats =~ 'alpha' ? '[[:alpha:][:digit:]]' : '[[:digit:]]'
call search(pattern, 'cw' . a:back)
execute 'normal! ' . v:count1 . a:char
silent! call repeat#set(":\<C-u>call AddSubtract('" .a:char. "', '" .a:back. "')\<CR>")
endfunction
nnoremap <silent> <C-a> :<C-u>call AddSubtract("\<C-a>", '')<CR>
nnoremap <silent> <Leader><C-a> :<C-u>call AddSubtract("\<C-a>", 'b')<CR>
nnoremap <silent> <C-x> :<C-u>call AddSubtract("\<C-x>", '')<CR>
nnoremap <silent> <Leader><C-x> :<C-u>call AddSubtract("\<C-x>", 'b')<CR>
" --------------------
" END Remap Keys }}}
" spellchecking {{{
" --------------------
" # Wann geladen wird # Maske # Aktivieren # Zu
" verwendende Sprache
au BufNewFile,BufRead,BufEnter *.wiki setlocal spell spelllang=en_us
au BufNewFile,BufRead,BufEnter *.md setlocal spell spelllang=en_us
au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=en_us
au BufNewFile,BufRead,BufEnter README setlocal spell spelllang=en_us
au BufNewFile,BufRead,BufEnter *.tex setlocal spell spelllang=en_us
" --------------------
" END of spellcheching }}}