-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
264 lines (205 loc) · 7 KB
/
vimrc
File metadata and controls
264 lines (205 loc) · 7 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
" ------------------------------------------------------------------------------
" ---------------------------------- Plugins -----------------------------------
" ------------------------------------------------------------------------------
"
" --------------------------------- Vim-Plug -----------------------------------
" Specify plugin directory
call plug#begin('~/.vim/plugins')
" fuzzy finding
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'mileszs/ack.vim'
" Git dots
Plug 'airblade/vim-gitgutter'
" NERDTree - File Explorer
Plug 'scrooloose/nerdtree'
" ALE Linter
Plug 'w0rp/ale'
" Airline - Status line
Plug 'vim-airline/vim-airline'
" Airline themes
Plug 'vim-airline/vim-airline-themes'
" EasyMotion - better vim navigations (f, t,...)
Plug 'easymotion/vim-easymotion'
" Unimpaired - useful keybindings
Plug 'tpope/vim-unimpaired'
" Better repeat with . e.g. for maps or other plugins
Plug 'tpope/vim-repeat'
" Change surroundings of text elements
Plug 'tpope/vim-surround'
" Comment and uncomment lines
Plug 'tpope/vim-commentary'
" Edit at multiple places
Plug 'terryma/vim-multiple-cursors'
" Molokai color scheme
Plug 'tomasr/molokai'
" Autoformat files
Plug 'Chiel92/vim-autoformat'
" " ---------------- Filetype plugins ---------------------
" Latex suite
Plug 'vim-latex/vim-latex', {'for': 'tex'}
" Better XML editing (tag completions, jumps, ...)
Plug 'sukima/xmledit', {'for': 'xml'}
" Better Python syntax highlighting
Plug 'hdima/python-syntax', {'for': 'python'}
" Python syntax annotations according to pep8
Plug 'nvie/vim-flake8', {'for': 'python'}
" Python folding
Plug 'tmhedberg/SimpylFold', {'for': 'python'}
" Python indentation
Plug 'vim-scripts/indentpython.vim', {'for': 'python'}
" Init plugin system
call plug#end()
" ------------------------------------------------------------------------------
" --------------------------------- Key bindings -------------------------------
" ------------------------------------------------------------------------------
" rebind esc because of Mac touch esc key
" esc in insert mode
inoremap jk <esc>
inoremap JK <esc>
" esc in command mode
cnoremap jk <C-C>
cnoremap JK <C-C>
" switch y and z keys to accustom for German keyboard...
" noremap z y
" noremap y z
set timeoutlen=500
let mapleader=" "
" New line without insert
nnoremap <leader>o o<Esc>
nnoremap <leader>O O<ESC>
" Moving between splits
nnoremap <C-j> <C-W><C-J>
nnoremap <C-k> <C-W><C-K>
nnoremap <C-h> <C-W><C-H>
nnoremap <C-l> <C-W><C-L>
" Keybinding for yanking and pasting from system keyboard
noremap <leader>p "+p
noremap <leader>P "+P
noremap <leader>y "+y
noremap <leader>d "+d
noremap <leader>D "+D
" resize horizontal splits
nnoremap <leader>hr :resize
"resize vertical splits
nnoremap <leader>vr :vertical resize
" Forward and backward movement in command mode
cnoremap <C-h> <Left>
cnoremap <C-l> <Right>
cnoremap <C-k> <Up>
cnoremap <C-j> <Down>
" toggling search highlight setting
noremap <leader>hs :set hlsearch! <cr>
" switch FOO and gFOO for comfortable navigation in wrapped documents
" noremap k gk
" noremap j gj
" noremap 0 g0
" noremap g0 0
" noremap $ g$
" noremap g0 0
" use tab as escape key
" nnoremap <Tab> <Esc>
" vnoremap <Tab> <Esc>gV
" onoremap <Tab> <Esc>
" cnoremap <Tab> <C-C><Esc>
" inoremap <Tab> <Esc>`^
" inoremap <Leader><Tab> <Tab>
" ------------------------------------------------------------------------------
" ------------------------------ Plugin Settings -------------------------------
" ------------------------------------------------------------------------------
" Ack/Ag -----------------------------------------------------------------------
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
nnoremap <leader>/ :Ack!<space>
" --------------------------------- Airline ------------------------------------
set laststatus=2 " show always
let g:airline_powerline_fonts = 1 " powerline font
" ---------------------------- autoformat --------------------------------------
nnoremap <leader>af :Autoformat<CR>
" fzf --------------------------------------------------------------------------
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
nnoremap <C-g> :Buffers<CR>
nnoremap <C-p> :Files<CR>
" gitgutter --------------------------------------------------------------------
set updatetime=100
" -------------------------------- NERDTree ------------------------------------
let g:NERDTreeIgnore = ['bin', 'node_modules']
nmap <leader>nt :NERDTreeToggle<CR>
" ------------------------------ SimpylFold ------------------------------------
let g:SimpylFold_docstring_preview=1
" ------------------------------ Vim-Latex -------------------------------------
let g:tex_flavor = 'latex'
set grepprg=grep\ -nH\ $*
let g:tex_indent_items = 0
set iskeyword+=:
nmap <C-Space> <Plug>Tex_FastEnvironmentInsert
imap <C-j> <Plug>IMAP_JumpForward
imap <S-CR> <Plug>IMAP_JumpForward
nmap <S-CR> <Plug>IMAP_JumpForward
vmap <S-CR> <Plug>IMAP_JumpForward
"not necessary? set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after
" ------------------------------------------------------------------------------
" --------------------------------- General ------------------------------------
" ------------------------------------------------------------------------------
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
" turn off compat mode for vi
set nocompatible
" syntax highlighting
syntax on
" spell check
set spell
set spelllang=en,de
" (relative) line numbers
set number
set relativenumber
" Indent configuration
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
set breakindent
" Show trailing whitespaces
set listchars=tab:•\ ,trail:•,extends:»,precedes:«
set invlist
" Search
set ignorecase
set smartcase
" show search result count
set shortmess-=S
" folding
set foldmethod=syntax
set foldlevelstart=100
let javaScript_fold=1 " JavaScript
let perl_fold=1 " Perl
let php_folding=1 " PHP
let r_syntax_folding=1 " R
let ruby_fold=1 " Ruby
let sh_fold_enabled=1 " sh
let vimsyn_folding='af' " Vim script
let xml_syntax_folding=1 " XML
" Scrolling
set scrolloff=3 " Keep 3 lines below and above the cursor
" Open splits on the right of existing ones
set splitright
" Open splits below existing ones
set splitbelow
" Enabling mouse scrolling
set mouse=a
" Show as much as possible of a wrapped last line, not just "@".
set display=lastline
" make backspace work like moth other programs
set backspace=indent,eol,start
" ------------------------------------------------------------------------------
" ---------------------------------- Appearance --------------------------------
" ------------------------------------------------------------------------------
" set termguicolors
" Good color alts: monokai (sublime default), one (atom default), OceanicNext
" colo molokai
colorscheme monokai
let g:airline_theme='badwolf' " reset nice airline theme
" Brighter number column
hi LineNr guifg=#aaaaaa
hi SpellBad guibg=#6d0000