rc

Replaced FuGitive with GitGutter.

Author
Vngngdn
Date
Oct. 7, 2016, 3:53 p.m.
Hash
00e078818830c6d7c1c6eda2d269f0f57458ac2f
Parent
1be49cadf6c061252f5c38fef05e54c114c99b41
Modified file
.vimrc

.vimrc

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