rc

Added an Eclim option to allow for better autocompletion in YCM for Vim.

Author
Vngngdn
Date
Oct. 1, 2016, 4:42 p.m.
Hash
354fff5348ce282394292f3576ab472be372d0da
Parent
7f269940fc58d981aa1ef005d8fbac273be205f3
Modified file
.vimrc

.vimrc

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