rc

Replaced Syntastic in favor of Neomake. Believe it or not, it's already paying off.

Author
Vngngdn
Date
Oct. 3, 2016, 6:32 p.m.
Hash
1be49cadf6c061252f5c38fef05e54c114c99b41
Parent
01337258730fe6ce444eedc38642a6496f4c141b
Modified file
.vimrc

.vimrc

9 additions and 7 deletions.

View changes Hide changes
1
1
" Some details on the contents:
2
2
" This file is my personal Vim configuration file. It contains my plugins, is
3
3
" divided to subject, and fattened with lovely comments.
4
4
" Please be advised that some (obvious) settings are left out, because I
5
5
" actually only use NeoVim. Again, this is my PERSONAL file, not a 'general
6
6
" public Vi(m) compatible' file.
7
7
8
8
" VUNDLE {{{
9
9
" Vundle is used to manage plugins for Vim. It needs additional setup, so it
10
10
" gets priority in my .vimrc.
11
11
12
12
filetype off                  " required
13
13
14
14
" set the runtime path to include Vundle and initialize
15
15
set rtp+=~/.vim/bundle/Vundle.vim
16
16
call vundle#begin()
17
17
18
18
" let Vundle manage Vundle, required
19
19
Plugin 'VundleVim/Vundle.vim'
20
20
21
21
" YCM is a plugin that allows Vim semantic type checking and more programming mumbo jumbo. It is godlike and it must always be there for me.
22
22
" XXX: This might be removed in favor of Deoplete. It depends on whether
23
-
" Deoplete is better or not.
24
-
Plugin 'Valloric/YouCompleteMe'
25
23
26
24
" Java is a holy language, and because of its holiness, it requires an onslaught
27
25
" of bloat software on your PC to even get a bit of semantic autocompletion.
28
26
" I've found a project which (at least) works without having to install Eclipse,
29
27
" Eclim, and whatever else you need. This is that tool.
30
28
Plugin 'artur-shaik/vim-javacomplete2'
31
29
32
30
" Airline provides a neat and feature rich status bar. Really nice to have.
+
31
" pretty cool and must-have.
+
32
Plugin 'neomake/neomake'
+
33
+
34
" Airline provides a neat and feature rich status bar. Really nice to have.
33
35
Plugin 'bling/vim-airline'
34
36
35
37
" Bufferline will show buffers in the status bar. There's enough room anyway, so I fancied having it.
36
38
Plugin 'bling/vim-bufferline'
37
39
38
40
" Syntastic does automatic syntax checking without the need to compile.
39
-
" XXX: Might be replaced in the future in favor of Neomake, because it's
40
-
" asynchronous, and I only use NeoVim these days, honestly.
41
-
Plugin 'scrooloose/syntastic'
42
-
43
-
" A fuzzy searcher. Just CTRL+P and BAM all your files are visible.
44
41
Plugin 'kien/ctrlp.vim'
45
42
46
43
" This plugin enables Git intergration.
47
44
Plugin 'tpope/vim-fugitive'
48
45
49
46
" This provides snippets for redundant code. Praise the hackers man.
50
47
Plugin 'SirVer/ultisnips'
51
48
52
49
" In addition to UltiSnips, this plugin contains a prefetched repository of snippets. Must have, because I'm not planning on writing all of those by myself.
53
50
Plugin 'honza/vim-snippets'
54
51
55
52
" Rust syntax files, including Syntastic integration:
56
53
" To be removed when these are added to (Neo)Vim 'upstream'.
57
54
Plugin 'rust-lang/rust.vim'
58
55
59
56
" All of your Plugins must be added before the following line
60
57
call vundle#end()            " required
61
58
filetype plugin indent on    " required
62
59
" }}}
63
60
64
61
" YOUCOMPLETEME {{{
65
62
" YouCompleteMe is a godlike completer for Vim. As such, it is worthy of its own section.
66
63
" However, I'll be trying out Deoplete in the future, which might render it
67
64
" obsolete. Until further notice, I'm keeping this beauty.
68
65
"
69
66
" This setting will force YCM to close the preview buffer after selecting the completion.
70
67
let g:ycm_autoclose_preview_window_after_completion=1
71
68
72
69
" Sets the symbol used to indicate a syntax error:
73
70
let g:ycm_error_symbol = '>>'
74
71
75
72
" Sets the symbol used to indicate a warning:
76
73
let g:ycm_warning_symbol = 'i'
77
74
78
75
" Fills the identifier completion database with the language's keywords (e.g., when starting a new Java file, "class" will already be in the completion engine.
79
76
let g:ycm_seed_identifiers_with_syntax = 1
80
77
81
78
" This setting tells YCM what keys to use to accept completion. I removed <Down> as default, because I'm a silly coder and still use my arrow keys to navigate my source files. Hey, years of negligence for Vim leaves its marks. To think I ever thought Notepad++ was the best editor ever, the fuck...
82
79
let g:ycm_key_list_select_completion=['<TAB>']
83
80
84
81
" Same reason; I'm a dumb fuck and arrows are still hardwired in my brain.
85
82
let g:ycm_key_list_previous_completion=['<S-TAB>']
86
83
87
84
" Configures the pointer to the ycm_extra_conf.py file.
88
85
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
89
86
let g:ycm_confirm_extra_conf = 0 " Disables security confirmation before loading the conf.py file.
90
87
91
88
" Configuration necessary for sematic Rust completion
92
89
let g:ycm_rust_src_path = '/usr/src/rust/src'
93
90
" }}}
94
91
"
95
92
" JAVACOMPLETE {{{
96
93
" Refraining from having to use Eclim and all the junk that attaches itself to
97
94
" it, means I have to use something else. Vim-javacomplete2 is that thing, but
98
95
" it has some additional settings that need to be set, in order to use it
99
96
" properly.
100
97
"
101
98
" Required; tell Vim that there's a completer for Java files:
102
99
autocmd FileType java setlocal omnifunc=javacomplete#Complete
103
100
" Stops adding closing braces, which conflicts with my way of thinking, which
104
101
" is: If I didn't hit the key for it, why the fuck is it on my screen.
105
102
let g:JavaComplete_ClosingBrace = 0
106
103
" JavaComplete uses a cache, which I can totally understand, because Java. I've
107
104
" set it to something more reasonable:
108
105
let g:JavaComplete_BaseDir = '~/.vim/.javacomplete-cache'
109
106
"
110
107
" TODO: javacomplete2 has a list of "default keymappings" on its GitHub page.
111
108
" It's possible that I'll have to delete these later. If so, refer to 
112
109
" https://github.com/artur-shaik/vim-javacomplete2#required
113
110
" }}}
114
111
"
115
112
" AIRLINE {{{
+
113
" This setting lets Neomake run on every file write:
+
114
autocmd! BufWritePost * Neomake
+
115
" }}}
+
116
"
+
117
" AIRLINE {{{
116
118
" Airline is a great status bar plugin. Although it can behave quirky if Powerline is not on the scene. These scripts are dedicated to handle that behavior.
117
119
118
120
" These lines will load the powerline font for use in Airline.
119
121
if !exists('g:airline_symbols')
120
122
		let g:airline_symbols={}
121
123
	endif
122
124
let g:airline_symbols.space="\ua0"
123
125
let g:airline_powerline_fonts=1
124
126
125
127
" If there is only one tab opened, the tab bar will display the different buffers.
126
128
let g:airline#extensions#tabline#enabled=1
127
129
let g:bufferline_echo = 0 " Disables automatic echoing to the bufferline.
128
130
129
131
" }}}
130
132
131
133
" ULTISNIPS {{{
132
134
" As mentioned earlier, this provides snippets to stop redundant code.
133
135
134
136
" To begin, changing default TAB, because YCM already uses TAB.
135
137
	let g:UltiSnipsExpandTrigger="<c-l>"
136
138
	let g:UltiSnipsJumpForwardTrigger="<c-j>"
137
139
	let g:UltiSnipsJumpBackwardTrigger="<c-k>"
138
140
139
141
" }}} 
140
142
"
141
143
" COLOURS & COLORS {{{
142
144
143
145
colorscheme molokai " I like molokai. I've used badwolf, but I like popping colors.
144
146
145
147
" }}}
146
148
147
149
" SPACES & TABS {{{
148
150
149
151
" The number of visual spaces per TAB hit.
150
152
set tabstop=4
151
153
152
154
" Setting the amount of tabs to 4. The default is 8.
153
155
set shiftwidth=4
154
156
155
157
" This breaks lines after column 80.
156
158
set textwidth=80
157
159
" }}}
158
160
159
161
" UI CONFIGURATION {{{
160
162
161
163
" The next 2 settings enable relative line numbering, but retain the absolute
162
164
" line numbering for the line currently selected by the cursor.
163
165
set number
164
166
set relativenumber
165
167
set cursorline " Highlights the line currently selected by the cursor.
166
168
filetype indent on " Detects filetype on load, and loads the appropriate syntax file.
167
169
set showmatch " Highlights matching parenthesis on hover ("[, {, ...").
168
170
" scrolloff tells Vim how much lines above/below the cursor should always be
169
171
" visible. For example, if set to 5, there will always be 5 lines below and
170
172
" above the cursor, except when reaching the EOF.
171
173
set scrolloff=5
172
174
" Next setting disables outputting the current mode to the last line. I did so,
173
175
" because I use Airline, which already prints the current mode.
174
176
set noshowmode
175
177
" }}}
176
178
177
179
" SEARCHING {{{
178
180
179
181
" Problem with hlsearch is that it does not turn off the highlighting. So searching for vowels may quickly result in everything being highlighted. This is a mapping. It will remove highlighting when entering \<SPACE>
180
182
nnoremap <leader><space> :nohlsearch<CR>
181
183
" }}}
182
184
183
185
" FOLDING {{{
184
186
" In case I forget (I'm Belgian), folding is hiding code parts that belong together, like functions. Très important. Fuck azerty.
185
187
186
188
" This enables folding as is.
187
189
set foldenable
188
190
189
191
" This setting determines how many folds have to be opened. The number indicates the folding level. So 0 = every possible folding is folded. 99 = practically everything is open. I'm using 10, since I already have a problem with more than 3 nested loops.
190
192
set foldlevelstart=10
191
193
192
194
" This setting blocks overuse of nested foldings. I don't know how this will turn out in LISP/Scheme, but I'll be damned if this setting does more harm than good.
193
195
set foldnestmax=10
194
196
195
197
" This setting is commented by default, but included in case I start to grow hate for the current way Vim handles folding (za). It basically maps that command to spacebar. I may map it to z because then I only have to type one letter and RETURN, that's 33% of my time saved! =3
196
198
"nnoremap <space> za
197
199
198
200
" }}}
199
201
200
202
" MOVEMENT {{{
201
203
202
204
" Up and down moving in Vim using j/k defaults to "physical line movement", i.e.
203
205
" if a line is too long, it's wrapped to the next line ("virtual lines"), but
204
206
" the line counter still regards it as 1 line.
205
207
" The next setting makes it so that, if j/k is pressed once, it moves over
206
208
" virtual lines, but when repeated (say "5dd"), it moves over physical lines.
207
209
" Basically, the perfect tradeoff solution when using relative line numbering.
208
210
noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
209
211
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
210
212
" Next 4 lines disable arrow keys.
211
213
noremap <Up> <nop>
212
214
noremap <Down> <nop>
213
215
noremap <Left> <nop>
214
216
noremap <Right> <nop>
215
217
" }}}
216
218
217
219
" BACKING UP {{{
218
220
219
221
" What these lines do, is move the backup files to the /tmp folder. This will keep my directories clean and neat.
220
222
set backup
221
223
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
222
224
set backupskip=/tmp/*,/private/tmp/*
223
225
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
224
226
set writebackup
225
227
" }}}
226
228
"
227
229
" NEOVIM {{{
228
230
" While it certainly is an improvement over 'vanilla' Vim, it does some things
229
231
" that keep me from using Vim as it's supposed to be; limited to no mouse usage.
230
232
" So I disable it. I'll enable it again when I've twisted my mind far enough to
231
233
" not touch my mouse again. (Not to mention some terminals don't support mouse
232
234
" control, so it's a bad habit nonetheless if you spend all your time on
233
235
" GNU/Linux distros)
234
236
set mouse=""
235
237
" }}}
236
238
"
237
239
" MACROS {{{
238
240
" Function that allows to quickly switch between relative and absolute numbering using
239
241
" CTRL+N(umber).
240
242
function! NumberToggle()
241
243
	if(&relativenumber == 1)
242
244
		set norelativenumber  " Necessary to disable the previous behavior.
243
245
		set number
244
246
	else
245
247
		set number " Retains absolute number on the current line.
246
248
		set relativenumber
247
249
	endif
248
250
endfunc
249
251
nnoremap <C-n> :call NumberToggle()<cr>
250
252
" }}}
251
253
" OTHER IMPORTANT STUFF {{{
252
254
253
255
254
256
" I found this gem on Reddit. If I'm editing a file that's read only, and I started Vim without sudo, then this little line will do just that for me. All I have to do is use "w!!" when saving.
255
257
" Extensive explanation can also be found at https://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work#7078429
256
258
cmap w!! w !sudo tee > /dev/null %
257
259
258
260
259
261
" This setting will allow me to switch to another buffer without need to save the current buffer.
260
262
set hidden
261
263
" }}}
262
264
263
265
" Because Vim can fold vimrc files with the right syntax, These lines will tell Vim how to handle that.
264
266
set modelines=2 "This tells Vim that the last 2 lines of this file should only apply to this file.
265
267
" So as you can see, the last 2 lines get a special vim:-prefix, so Vim knows for sure this is what's important.
266
268
" To wrap a new section, look at the other sections, and copy that syntax.
267
269
" vim:foldmethod=marker
268
270
" vim:foldlevel=0
269
271