rc

Set scrolloff value in .vimrc to 9999, to freeze my line in the middle.

Author
Vngngdn
Date
Aug. 9, 2016, 5:37 p.m.
Hash
7b1e834c28982c5611e6cf7ea6de7c6909d88c96
Parent
3d69969f01a2a04587531d94a3336ed744af6693
Modified file
.vimrc

.vimrc

10 additions and 5 deletions.

View changes Hide changes
1
1
" I'll most certainly add comments to every fucking line I write. It goes
2
-
" without saying that I need to know what every line does.
3
-
+
2
" This file is my personal Vim configuration file. It contains my plugins, is
+
3
" divided to subject, and fattened with lovely comments.
+
4
" Please be advised that some (obvious) settings are left out, because I
+
5
" actually only use NeoVim. Again, this is my PERSONAL file, not a 'general
+
6
" public Vi(m) compatible' file.
+
7
4
8
" VUNDLE {{{
5
9
" Vundle is used to manage plugins for Vim. It needs additional setup, so it
6
10
" gets priority in my .vimrc.
7
11
8
12
filetype off                  " required
9
13
10
14
" set the runtime path to include Vundle and initialize
11
15
set rtp+=~/.vim/bundle/Vundle.vim
12
16
call vundle#begin()
13
17
14
18
" let Vundle manage Vundle, required
15
19
Plugin 'VundleVim/Vundle.vim'
16
20
17
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.
18
22
" XXX: This might be removed in favor of Deoplete. It depends on whether
19
23
" Deoplete is better or not.
20
24
Plugin 'Valloric/YouCompleteMe'
21
25
22
26
" Airline provides a neat and feature rich status bar. Really nice to have.
23
27
Plugin 'bling/vim-airline'
24
28
25
29
" Bufferline will show buffers in the status bar. There's enough room anyway, so I fancied having it.
26
30
Plugin 'bling/vim-bufferline'
27
31
28
32
" Syntastic does automatic syntax checking without the need to compile.
29
33
" XXX: Might be replaced in the future in favor of Neomake, because it's
30
34
" asynchronous, and I only use NeoVim these days, honestly.
31
35
Plugin 'scrooloose/syntastic'
32
36
33
37
" A fuzzy searcher. Just CTRL+P and BAM all your files are visible.
34
38
Plugin 'kien/ctrlp.vim'
35
39
36
40
" This plugin enables Git intergration.
37
41
Plugin 'tpope/vim-fugitive'
38
42
39
43
" This provides snippets for redundant code. Praise the hackers man.
40
44
Plugin 'SirVer/ultisnips'
41
45
42
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.
43
47
Plugin 'honza/vim-snippets'
44
48
45
49
" Rust syntax files, including Syntastic integration:
46
50
" To be removed when these are added to (Neo)Vim 'upstream'.
47
51
Plugin 'rust-lang/rust.vim'
48
52
49
53
" All of your Plugins must be added before the following line
50
54
call vundle#end()            " required
51
55
filetype plugin indent on    " required
52
56
" }}}
53
57
54
58
" YOUCOMPLETEME {{{
55
59
" YouCompleteMe is a godlike completer for Vim. As such, it is worthy of its own section.
56
60
" However, I'll be trying out Deoplete in the future, which might render it
57
61
" obsolete. Until further notice, I'm keeping this beauty.
58
62
"
59
63
" This setting will force YCM to close the preview buffer after selecting the completion.
60
64
let g:ycm_autoclose_preview_window_after_completion=1
61
65
62
66
" Sets the symbol used to indicate a syntax error:
63
67
let g:ycm_error_symbol = '>>'
64
68
65
69
" Sets the symbol used to indicate a warning:
66
70
let g:ycm_warning_symbol = 'i'
67
71
68
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.
69
73
let g:ycm_seed_identifiers_with_syntax = 1
70
74
71
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...
72
76
let g:ycm_key_list_select_completion=['<TAB>']
73
77
74
78
" Same reason; I'm a dumb fuck and arrows are still hardwired in my brain.
75
79
let g:ycm_key_list_previous_completion=['<S-TAB>']
76
80
77
81
" Configures the pointer to the ycm_extra_conf.py file.
78
82
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
79
83
let g:ycm_confirm_extra_conf = 0 " Disables security confirmation before loading the conf.py file.
80
84
81
85
" Configuration necessary for sematic Rust completion
82
86
let g:ycm_rust_src_path = '/usr/src/rust/src'
83
87
" }}}
84
88
85
89
" AIRLINE {{{
86
90
" 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
91
88
92
89
-
90
-
" 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
" }}}
119
121
120
122
" SPACES & TABS {{{
121
123
122
124
" The number of visual spaces per TAB hit.
123
125
set tabstop=4
124
126
125
127
" Setting the amount of tabs to 4. The default is 8.
126
128
set shiftwidth=4
127
129
128
130
" This breaks lines after column 80.
129
131
set textwidth=80
130
132
" }}}
131
133
132
134
" UI CONFIGURATION {{{
133
135
134
136
set relativenumber  " I used to use standard numbers, but relative numbers make moving around so much easier.
135
137
set cursorline " Highlights the line currently selected by the cursor.
136
138
filetype indent on " Detects filetype on load, and loads the appropriate syntax file.
137
139
" This highlights the matching parenthesis ([, {, (, ...). I think this is default, but in case it's not, tadaa.
138
140
set showmatch " Highlights matching parenthesis on hover ("[, {, ...").
139
141
set scrolloff=5  " It may seem a lot, but I like to have some content always visible.
140
-
" }}}
+
142
" visible. For example, if set to 5, there will always be 5 lines below and
+
143
" above the cursor, except when reaching the EOF.
+
144
set scrolloff=9999  " A ridiculously high value 'freezes' the line in the middle of the terminal.
+
145
" }}}
141
146
142
147
" SEARCHING {{{
143
148
144
149
" 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>
145
150
nnoremap <leader><space> :nohlsearch<CR>
146
151
" }}}
147
152
148
153
" FOLDING {{{
149
154
" In case I forget (I'm Belgian), folding is hiding code parts that belong together, like functions. Très important. Fuck azerty.
150
155
151
156
" This enables folding as is.
152
157
set foldenable
153
158
154
159
" 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.
155
160
set foldlevelstart=10
156
161
157
162
" 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.
158
163
set foldnestmax=10
159
164
160
165
" 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
161
166
"nnoremap <space> za
162
167
163
168
" }}}
164
169
165
170
" MOVEMENT {{{
166
171
167
172
" 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.
168
173
nnoremap j gj
169
174
nnoremap k gk
170
175
" }}}
171
176
172
177
" BACKING UP {{{
173
178
174
179
" What these lines do, is move the backup files to the /tmp folder. This will keep my directories clean and neat.
175
180
set backup
176
181
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
177
182
set backupskip=/tmp/*,/private/tmp/*
178
183
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
179
184
set writebackup
180
185
" }}}
181
186
"
182
187
" NEOVIM {{{
183
188
" While it certainly is an improvement over 'vanilla' Vim, it does some things
184
189
" that keep me from using Vim as it's supposed to be; limited to no mouse usage.
185
190
" So I disable it. I'll enable it again when I've twisted my mind far enough to
186
191
" not touch my mouse again. (Not to mention some terminals don't support mouse
187
192
" control, so it's a bad habit nonetheless if you spend all your time on
188
193
" GNU/Linux distros)
189
194
set mouse=""
190
195
" }}}
191
196
"
192
197
" MACROS {{{
193
198
" Function taken from
194
199
" http://jeffkreeftmeijer.com/2012/relative-line-numbers-in-vim-for-super-fast-movement/
195
200
" that allows to quickly switch between relative and absolute numbering using
196
201
" CTRL+N(umber).
197
202
function! NumberToggle()
198
203
	if(&relativenumber == 1)
199
204
		set norelativenumber  " Necessary to disable the previous behavior.
200
205
		set number
201
206
	else
202
207
		set nonumber  " Idem
203
208
		set relativenumber
204
209
	endif
205
210
endfunc
206
211
nnoremap <C-n> :call NumberToggle()<cr>
207
212
" }}}
208
213
" OTHER IMPORTANT STUFF {{{
209
214
210
215
211
216
" 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.
212
217
" Extensive explanation can also be found at https://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work#7078429
213
218
cmap w!! w !sudo tee > /dev/null %
214
219
215
220
216
221
" This setting will allow me to switch to another buffer without need to save the current buffer.
217
222
set hidden
218
223
" }}}
219
224
220
225
" Because Vim can fold vimrc files with the right syntax, These lines will tell Vim how to handle that.
221
226
set modelines=2 "This tells Vim that the last 2 lines of this file should only apply to this file.
222
227
" So as you can see, the last 2 lines get a special vim:-prefix, so Vim knows for sure this is what's important.
223
228
" To wrap a new section, look at the other sections, and copy that syntax.
224
229
" vim:foldmethod=marker
225
230
" vim:foldlevel=0
226
231