-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
195 lines (162 loc) · 5.19 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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'wincent/command-t'
Plugin 'tpope/vim-fugitive'
Plugin '29decibel/codeschool-vim-theme'
Plugin 'altercation/vim-colors-solarized'
let g:solarized_termcolors=256
Plugin 'morhetz/gruvbox'
Plugin 'tpope/vim-unimpaired'
Plugin 'jlanzarotta/bufexplorer'
Plugin 'scrooloose/nerdcommenter'
Plugin 'lervag/vimtex'
Plugin 'vim-scripts/DoxygenToolkit.vim'
" vimtex options:
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique @pdf\#src:@line@tex'
let g:vimtex_view_general_options_latexmk = '--unique'
let g:vimtex_indent_enabled = 0 " Try to reduce lag when typing brackets
let g:vimtex_compiler_latexmk = {'callback' : 0} " prevent servername error
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
"Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
"Plugin 'L9'
" easily deal with brackets
Plugin 'tpope/vim-surround'
" nerdtree
Plugin 'scrooloose/nerdtree'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line" Configure ctrlp
" Ignore certain folders
set wildignore+=*/doc/*,*/libopencm3/*,*/chibios/*,*/var/*,*.aux,
"set leader key
let mapleader = "\<Space>"
let maplocalleader = ","
" Set tabstop, softtabstop and shiftwidth to the same value
command! -nargs=* Stab call Stab()
function! Stab()
let l:tabstop = 1 * input('set tabstop = softtabstop = shiftwidth = ')
if l:tabstop > 0
let &l:sts = l:tabstop
let &l:ts = l:tabstop
let &l:sw = l:tabstop
endif
call SummarizeTabs()
endfunction
function! SummarizeTabs()
try
echohl ModeMsg
echon 'tabstop='.&l:ts
echon ' shiftwidth='.&l:sw
echon ' softtabstop='.&l:sts
if &l:et
echon ' expandtab'
else
echon ' noexpandtab'
endif
finally
echohl None
endtry
endfunction
" Only do this part when compiled with support for autocommands
if has("autocmd")
" Enable file type detection
filetype on
" Syntax of these languages is fussy over tabs Vs spaces
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType c setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType c set syntax=c.doxygen
autocmd FileType cpp setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType xml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType tex setlocal ts=2 sts=2 sw=2 noexpandtab
autocmd FileType bib setlocal ts=2 sts=2 sw=2 noexpandtab
autocmd FileType py setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType tex :NoMatchParen
autocmd FileType tex set norelativenumber
au FileType tex setlocal nocursorline
" Treat .rss files as XML
" autocmd BufNewFile,BufRead *.rss setfiletype xml
"strip trailing whitespace upon save
autocmd FileType c autocmd BufWritePre <buffer> %s/\s\+$//e
" Source the vimrc file after saving it
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
endif
augroup filetypedetect
" Some LaTeX types
au! BufRead,BufNewFile *.cls setfiletype tex
au! BufRead,BufNewFile *.lco setfiletype tex
augroup END
set relativenumber
set number
"Make Ctrl-[ also exit in visual mode
vnoremap <Ctrl>[ <Esc>
"colo solarized
colo gruvbox
set background=dark
"Use smart indentation
set smartindent
"set search parameters
set incsearch hlsearch ic smartcase
" Set mouse to 'alles wat je verwacht'
set mouse=a
"NERDTree mappings
nmap <silent> <Leader>n :NERDTreeToggle<CR>
nmap <silent> <Leader>f :NERDTreeFind<CR>
"other mappings
nnoremap <Leader>w :w<CR>
" vmap <Leader>y "+y
" vmap <Leader>d "+d
" nmap <Leader>p "+p
" nmap <Leader>P "+P
" vmap <Leader>p "+p
" vmap <Leader>P "+P
" nmap <Leader>y "+y
" nnoremap <Leader>yy "+yy
" These mappings are not necessary if you use:
set clipboard=unnamedplus
" easy navigate splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" move cursor to new window
set splitbelow
set splitright
set timeout timeoutlen=800 ttimeoutlen=100
" Shows options when tab-autocompleting
set wildmenu
" Autocomplete options
set wildmode=longest,list,full
" Allow going into non-existing fields with block edit
set ve=block
" keep undo history
set hidden
" warning when file changed on disk
au BufWinEnter * checktime
" abbreviation for long name
cnoreabbrev vtc VimtexCompile
"Save commonly used regex
source ~/.vim/regexlist