rc

Added Rust syntax loader to Vundle in .vimrc.

Author
Vngngdn
Date
June 28, 2016, 7:12 p.m.
Hash
39caf4b9b0993f0998c1582067480e22f5d7d3e8
Parent
1fcccd2009948a1c97ef83819cf90968f6a1a455
Modified file
.vimrc

.vimrc

7 additions and 38 deletions.

View changes Hide changes
1
1
"I'll most certainly add comments to every fucking line I write. It goes without saying that I need to know what every line does.
2
2
3
3
" VUNDLE {{{
4
4
"Vundle is used to manage plugins for Vim. It needs additional setup, so it gets priority in my .vimrc.
5
5
"Note that this part is a verbatim copy of VundleVim's GitHub page.
6
-
7
6
filetype off                  " required
8
7
9
8
" set the runtime path to include Vundle and initialize
10
9
set rtp+=~/.vim/bundle/Vundle.vim
11
10
call vundle#begin()
12
11
13
12
" let Vundle manage Vundle, required
14
13
Plugin 'VundleVim/Vundle.vim'
15
14
16
15
" 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.
17
16
" XXX: This might be removed in favor of Deoplete. It depends on whether
18
17
" Deoplete is better or not.
19
18
Plugin 'Valloric/YouCompleteMe'
20
19
21
20
" Airline provides a neat and feature rich status bar. Really nice to have.
22
21
Plugin 'bling/vim-airline'
23
22
24
23
" Bufferline will show buffers in the status bar. There's enough room anyway, so I fancied having it.
25
24
Plugin 'bling/vim-bufferline'
26
25
27
26
" Syntastic does automatic syntax checking without the need to compile.
28
27
" XXX: Might be replaced in the future in favor of Neomake, because it's
29
28
" asynchronous, and I only use NeoVim these days, honestly.
30
29
Plugin 'scrooloose/syntastic'
31
30
32
31
" A fuzzy searcher. Just CTRL+P and BAM all your files are visible.
33
32
Plugin 'kien/ctrlp.vim'
34
33
35
34
" This plugin enables Git intergration.
36
35
Plugin 'tpope/vim-fugitive'
37
36
38
37
" This provides snippets for redundant code. Praise the hackers man.
39
38
Plugin 'SirVer/ultisnips'
40
39
41
40
" 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.
42
41
Plugin 'honza/vim-snippets'
43
42
44
43
" All of your Plugins must be added before the following line
+
44
Plugin 'rust-lang/rust.vim'
+
45
+
46
" All of your Plugins must be added before the following line
45
47
call vundle#end()            " required
46
48
filetype plugin indent on    " required
47
49
" To ignore plugin indent changes, instead use:
48
50
"filetype plugin on
49
51
"
50
52
" Brief help
51
53
" :PluginList       - lists configured plugins
52
54
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
53
55
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
54
56
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
55
57
"
56
58
" see :h vundle for more details or wiki for FAQ
57
59
" Put your non-Plugin stuff after this line
58
60
" }}}
59
61
60
62
" YOUCOMPLETEME {{{
61
63
" YouCompleteMe is a godlike completer for Vim. As such, it is worthy of its own section.
62
64
" However, I'll be trying out Deoplete in the future, which might render it
63
65
" obsolete. Until further notice, I'm keeping this beauty.
64
66
"
65
67
" This setting will force YCM to close the preview buffer after selecting the completion.
66
68
let g:ycm_autoclose_preview_window_after_completion=1
67
69
68
70
" Sets the symbol used to indicate a syntax error:
69
71
let g:ycm_error_symbol = '>>'
70
72
71
73
" Sets the symbol used to indicate a warning:
72
74
let g:ycm_warning_symbol = 'i'
73
75
74
76
" 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.
75
77
let g:ycm_seed_identifiers_with_syntax=0
76
78
77
79
" 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...
78
80
let g:ycm_key_list_select_completion=['<TAB>']
79
81
80
82
" Same reason; I'm a dumb fuck and arrows are still hardwired in my brain.
81
83
let g:ycm_key_list_previous_completion=['<S-TAB>']
82
84
83
85
" }}}
84
86
85
87
" AIRLINE {{{
86
88
" 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.
87
89
88
90
89
91
90
92
" These lines will load the powerline font for use in Airline.
91
93
if !exists('g:airline_symbols')
92
94
		let g:airline_symbols={}
93
95
endif
94
96
let g:airline_symbols.space="\ua0"
95
97
let g:airline_powerline_fonts=1
96
98
97
99
" If there is only one tab opened, the tab bar will display the different buffers.
98
100
let g:airline#extensions#tabline#enabled=1
99
101
100
102
" Makes Airline appear immediately, instead of waiting for a split.
101
103
set laststatus=2
102
104
" }}}
103
105
104
106
" ULTISNIPS {{{
105
107
" As mentioned earlier, this provides snippets to stop redundant code.
106
108
107
109
" To begin, changing default TAB, because YCM already uses TAB.
108
110
	let g:UltiSnipsExpandTrigger="<c-l>"
109
111
	let g:UltiSnipsJumpForwardTrigger="<c-j>"
110
112
	let g:UltiSnipsJumpBackwardTrigger="<c-k>"
111
113
112
114
" }}} 
113
115
"
114
116
" COLOURS & COLORS {{{
115
117
116
118
colorscheme molokai " I like molokai. I've used badwolf, but I like popping colors.
117
119
118
120
" Enables syntax processing. Might as well take my liver as well since I can't live without syntax processing either. Vim really is a life saver huh? :)
119
-
syntax enable
120
-
" }}}
121
121
122
122
" SPACES & TABS {{{
123
123
124
124
" The number of visual spaces per TAB hit.
125
125
set tabstop=4
126
126
127
127
" Setting the amount of tabs to 4. The default is 8.
128
128
set shiftwidth=4
129
129
130
130
" This breaks lines after column 80.
131
131
set textwidth=80
132
132
" }}}
133
133
134
134
" UI CONFIGURATION {{{
135
135
136
136
" Seriously. If Vim wasn't so barebones, I'd have spammed the mailing list to make this default. But because Vim is completely customizable, I think it's good I have to manually add this. BTW, this creates line numbers.
137
-
set number
138
-
139
-
" This highlights the current line. Loved this back in Gedit and Notepad++, and I want it, or I'm gonna bust a tit.
140
-
set cursorline
141
-
142
-
" Detects filetype, and loads the appropriate language indentation files. I love this. It's so cumbersome to constantly hit TAB because of readability. Also Python needs this.
143
-
filetype indent on
144
-
145
-
" In addition, this automatically indents shit.
146
-
set autoindent
147
-
148
-
" Ermagherd. This throws a wildmenu when you can use autocomplete to cycle trough files. GIMME GIMME
149
-
set wildmenu
150
-
151
-
" So apparantly, Vim has a tendency to redraw the entire screen when it's not really necessary. This tells it to only redraw when unnecessary. If menus don't disappear, I think this is the line to comment out first.
152
-
set lazyredraw
153
-
154
-
" This highlights the matching parenthesis ([, {, (, ...). I think this is default, but in case it's not, tadaa.
+
137
set cursorline " Highlights the line currently selected by the cursor.
+
138
filetype indent on " Detects filetype on load, and loads the appropriate syntax file.
+
139
" This highlights the matching parenthesis ([, {, (, ...). I think this is default, but in case it's not, tadaa.
155
140
set showmatch
156
-
" }}}
+
141
" }}}
157
142
158
143
" SEARCHING {{{
159
144
160
145
" What this does, is, when you type a character to search, Vim automatically goes to the first occurrence. When refining the search, it does that again. So searching goes that bit faster.
161
-
set incsearch
162
-
163
-
" This will highlight all occurrences when searching on the go.
164
-
set hlsearch
165
-
166
-
" 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>
167
146
nnoremap <leader><space> :nohlsearch<CR>
168
147
" }}}
169
148
170
149
" FOLDING {{{
171
150
" In case I forget (I'm Belgian), folding is hiding code parts that belong together, like functions. Très important. Fuck azerty.
172
151
173
152
" This enables folding as is.
174
153
set foldenable
175
154
176
155
" 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.
177
156
set foldlevelstart=10
178
157
179
158
" 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.
180
159
set foldnestmax=10
181
160
182
161
" 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
183
162
"nnoremap <space> za
184
163
185
164
" Again, because Python is thé best programming language ever made (not perfect, but still the best), folding based on indentation is imperative. This command does exactly that. Who needs {}? Although this causes it to not care about {} folding. Other acceptable values are marker, manual, expr, syntax, diff.
186
-
"set foldmethod=indent
187
-
" }}}
188
165
189
166
" MOVEMENT {{{
190
167
191
168
" When you go up, and you have a line going over multiple lines because it's too long, the standard mapping will skip that. These two settings will block that behaviour.
192
169
nnoremap j gj
193
170
nnoremap k gk
194
171
" }}}
195
172
196
173
" BACKING UP {{{
197
174
198
175
" What these lines do, is move the backup files to the /tmp folder. This will keep my directories clean and neat.
199
176
set backup
200
177
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
201
178
set backupskip=/tmp/*,/private/tmp/*
202
179
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
203
180
set writebackup
204
181
" }}}
205
182
"
206
183
" MACROS {{{
207
184
" Macros are the FSM's present to the glorious users of Vim. They make my life a breeze, so I declare a couple of them right here.
208
-
"
209
-
" This macro is for Python classes: It takes the given word at the line, and makes a property-style handler with that word.
210
-
" }}}
211
185
" OTHER IMPORTANT STUFF {{{
212
186
213
187
" Disables Vi compatibility. All stop using Vi. It's proprietary, shitty, fucked up, and as useless as Windows Notepad. Might as well use Ed. Besides, there's no place for Vi in the Church of Emacs, vi vi vi is the editor of the beast.
214
-
set nocompatible
215
-
216
-
217
188
" 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.
218
189
" Extensive explanation can also be found at https://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work#7078429
219
190
cmap w!! w !sudo tee > /dev/null %
220
191
221
192
" This is a goodie that I forgot (added 06/11/2015 22:54 Brussels Winter time (Yes, I still haven't set Git up properly, so timestamp): It says Vim to use UTF-8 encoding.
222
-
set encoding=utf8
223
-
224
193
" This setting will allow me to switch to another buffer without need to save the current buffer.
225
194
set hidden
226
195
" }}}
227
196
228
197
" Because Vim can fold vimrc files with the right syntax, These lines will tell Vim how to handle that.
229
198
set modelines=2 "This tells Vim that the last 2 lines of this file should only apply to this file.
230
199
" So as you can see, the last 2 lines get a special vim:-prefix, so Vim knows for sure this is what's important.
231
200
" To wrap a new section, look at the other sections, and copy that syntax.
232
201
" vim:foldmethod=marker
233
202
" vim:foldlevel=0
234
203