So, what I did to the .vimrc:
- Added vim-hardtime, so I can start using my keyboard properly. - Added some settings for hardtime, including the removal of the arrow keys. - Fixed some line breaking from a long while ago, before the time I broke them automatically. It gets very confusing with relative numbering on. - Scrambled through the YCM configuration block, and found out that I totally mistyped the ycm_seed_identifiers_with_syntax. It's supposed to be 1. But yeah, fixed that now, you didn't see anything.
- Author
- Vngngdn
- Date
- July 11, 2016, 4:47 p.m.
- Hash
- 638bf501b8e284ac3984dcb3c1e7e54e7c9b37f3
- Parent
- 8f22227036fc09ba493122bca57d03ef3639e332
- Modified file
- .vimrc
.vimrc ¶
20 additions and 15 deletions.
View changes Hide changes
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 |
- | |
+ |
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 |
|
3 |
4 |
" VUNDLE {{{ |
4 |
5 |
"Vundle is used to manage plugins for Vim. It needs additional setup, so it gets priority in my .vimrc. |
5 |
- | |
+ |
6 |
" gets priority in my .vimrc. |
+ |
7 |
|
6 |
8 |
filetype off " required |
7 |
9 |
|
8 |
10 |
" set the runtime path to include Vundle and initialize |
9 |
11 |
set rtp+=~/.vim/bundle/Vundle.vim |
10 |
12 |
call vundle#begin() |
11 |
13 |
|
12 |
14 |
" let Vundle manage Vundle, required |
13 |
15 |
Plugin 'VundleVim/Vundle.vim' |
14 |
16 |
|
15 |
17 |
" 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. |
16 |
18 |
" XXX: This might be removed in favor of Deoplete. It depends on whether |
17 |
19 |
" Deoplete is better or not. |
18 |
20 |
Plugin 'Valloric/YouCompleteMe' |
19 |
21 |
|
20 |
22 |
" Airline provides a neat and feature rich status bar. Really nice to have. |
21 |
23 |
Plugin 'bling/vim-airline' |
22 |
24 |
|
23 |
25 |
" Bufferline will show buffers in the status bar. There's enough room anyway, so I fancied having it. |
24 |
26 |
Plugin 'bling/vim-bufferline' |
25 |
27 |
|
26 |
28 |
" Syntastic does automatic syntax checking without the need to compile. |
27 |
29 |
" XXX: Might be replaced in the future in favor of Neomake, because it's |
28 |
30 |
" asynchronous, and I only use NeoVim these days, honestly. |
29 |
31 |
Plugin 'scrooloose/syntastic' |
30 |
32 |
|
31 |
33 |
" A fuzzy searcher. Just CTRL+P and BAM all your files are visible. |
32 |
34 |
Plugin 'kien/ctrlp.vim' |
33 |
35 |
|
34 |
36 |
" This plugin enables Git intergration. |
35 |
37 |
Plugin 'tpope/vim-fugitive' |
36 |
38 |
|
37 |
39 |
" This provides snippets for redundant code. Praise the hackers man. |
38 |
40 |
Plugin 'SirVer/ultisnips' |
39 |
41 |
|
40 |
42 |
" 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. |
41 |
43 |
Plugin 'honza/vim-snippets' |
42 |
44 |
|
43 |
45 |
" Rust syntax files, including Syntastic integration: |
44 |
46 |
Plugin 'rust-lang/rust.vim' |
+ |
47 |
Plugin 'rust-lang/rust.vim' |
45 |
48 |
|
46 |
49 |
" All of your Plugins must be added before the following line |
+ |
50 |
" This plugin will stay here until I've kicked the habit properly. |
+ |
51 |
Plugin 'takac/vim-hardtime' |
+ |
52 |
|
+ |
53 |
" All of your Plugins must be added before the following line |
47 |
54 |
call vundle#end() " required |
48 |
55 |
filetype plugin indent on " required |
49 |
56 |
" To ignore plugin indent changes, instead use: |
50 |
- | "filetype plugin on |
51 |
- | " |
52 |
- | " Brief help |
53 |
- | " :PluginList - lists configured plugins |
54 |
- | " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate |
55 |
- | " :PluginSearch foo - searches for foo; append `!` to refresh local cache |
56 |
- | " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal |
57 |
- | " |
58 |
- | " see :h vundle for more details or wiki for FAQ |
59 |
- | " Put your non-Plugin stuff after this line |
60 |
- | " }}} |
61 |
57 |
|
62 |
58 |
" YOUCOMPLETEME {{{ |
63 |
59 |
" YouCompleteMe is a godlike completer for Vim. As such, it is worthy of its own section. |
64 |
60 |
" However, I'll be trying out Deoplete in the future, which might render it |
65 |
61 |
" obsolete. Until further notice, I'm keeping this beauty. |
66 |
62 |
" |
67 |
63 |
" This setting will force YCM to close the preview buffer after selecting the completion. |
68 |
64 |
let g:ycm_autoclose_preview_window_after_completion=1 |
69 |
65 |
|
70 |
66 |
" Sets the symbol used to indicate a syntax error: |
71 |
67 |
let g:ycm_error_symbol = '>>' |
72 |
68 |
|
73 |
69 |
" Sets the symbol used to indicate a warning: |
74 |
70 |
let g:ycm_warning_symbol = 'i' |
75 |
71 |
|
76 |
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. |
77 |
73 |
let g:ycm_seed_identifiers_with_syntax=0 |
78 |
- | |
+ |
74 |
|
79 |
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... |
80 |
76 |
let g:ycm_key_list_select_completion=['<TAB>'] |
81 |
77 |
|
82 |
78 |
" Same reason; I'm a dumb fuck and arrows are still hardwired in my brain. |
83 |
79 |
let g:ycm_key_list_previous_completion=['<S-TAB>'] |
84 |
80 |
|
85 |
81 |
" }}} |
86 |
82 |
|
87 |
83 |
" AIRLINE {{{ |
88 |
84 |
" 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. |
89 |
85 |
|
90 |
86 |
|
91 |
87 |
|
92 |
88 |
" These lines will load the powerline font for use in Airline. |
93 |
89 |
if !exists('g:airline_symbols') |
94 |
90 |
let g:airline_symbols={} |
95 |
91 |
endif |
96 |
92 |
let g:airline_symbols.space="\ua0" |
97 |
93 |
let g:airline_powerline_fonts=1 |
98 |
94 |
|
99 |
95 |
" If there is only one tab opened, the tab bar will display the different buffers. |
100 |
96 |
let g:airline#extensions#tabline#enabled=1 |
101 |
97 |
|
102 |
98 |
" Makes Airline appear immediately, instead of waiting for a split. |
103 |
99 |
set laststatus=2 |
104 |
100 |
" }}} |
105 |
101 |
|
106 |
102 |
" ULTISNIPS {{{ |
107 |
103 |
" As mentioned earlier, this provides snippets to stop redundant code. |
108 |
104 |
|
109 |
105 |
" To begin, changing default TAB, because YCM already uses TAB. |
110 |
106 |
let g:UltiSnipsExpandTrigger="<c-l>" |
111 |
107 |
let g:UltiSnipsJumpForwardTrigger="<c-j>" |
112 |
108 |
let g:UltiSnipsJumpBackwardTrigger="<c-k>" |
113 |
109 |
|
114 |
110 |
" }}} |
115 |
111 |
" |
116 |
112 |
" COLOURS & COLORS {{{ |
+ |
113 |
" HARDTIME {{{ |
+ |
114 |
" Some settings are required to make vim-hardtime function properly |
+ |
115 |
let g:hardtime_default_on = 1 " Start hardtime immediately. |
+ |
116 |
let g:hardtime_allow_different_key = 1 " Allows 'jhk', but not 'jjj'. |
+ |
117 |
" Using the arrow keys is (arguably) a bad habit as well, so they're disabled: |
+ |
118 |
let g:list_of_disabled_keys = ["<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"] |
+ |
119 |
" }}} |
+ |
120 |
|
+ |
121 |
" COLOURS & COLORS {{{ |
117 |
122 |
|
118 |
123 |
colorscheme molokai " I like molokai. I've used badwolf, but I like popping colors. |
119 |
124 |
|
120 |
125 |
" }}} |
121 |
126 |
|
122 |
127 |
" SPACES & TABS {{{ |
123 |
128 |
|
124 |
129 |
" The number of visual spaces per TAB hit. |
125 |
130 |
set tabstop=4 |
126 |
131 |
|
127 |
132 |
" Setting the amount of tabs to 4. The default is 8. |
128 |
133 |
set shiftwidth=4 |
129 |
134 |
|
130 |
135 |
" This breaks lines after column 80. |
131 |
136 |
set textwidth=80 |
132 |
137 |
" }}} |
133 |
138 |
|
134 |
139 |
" UI CONFIGURATION {{{ |
135 |
140 |
|
136 |
141 |
set relativenumber " I used to use standard numbers, but relative numbers make moving around so much easier. |
137 |
142 |
set cursorline " Highlights the line currently selected by the cursor. |
138 |
143 |
filetype indent on " Detects filetype on load, and loads the appropriate syntax file. |
139 |
144 |
" This highlights the matching parenthesis ([, {, (, ...). I think this is default, but in case it's not, tadaa. |
140 |
145 |
set showmatch " Highlights matching parenthesis on hover ("[, {, ..."). |
141 |
146 |
" }}} |
142 |
147 |
|
143 |
148 |
" SEARCHING {{{ |
144 |
149 |
|
145 |
150 |
" 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> |
146 |
151 |
nnoremap <leader><space> :nohlsearch<CR> |
147 |
152 |
" }}} |
148 |
153 |
|
149 |
154 |
" FOLDING {{{ |
150 |
155 |
" In case I forget (I'm Belgian), folding is hiding code parts that belong together, like functions. Très important. Fuck azerty. |
151 |
156 |
|
152 |
157 |
" This enables folding as is. |
153 |
158 |
set foldenable |
154 |
159 |
|
155 |
160 |
" 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. |
156 |
161 |
set foldlevelstart=10 |
157 |
162 |
|
158 |
163 |
" 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. |
159 |
164 |
set foldnestmax=10 |
160 |
165 |
|
161 |
166 |
" 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 |
162 |
167 |
"nnoremap <space> za |
163 |
168 |
|
164 |
169 |
" }}} |
165 |
170 |
|
166 |
171 |
" MOVEMENT {{{ |
167 |
172 |
|
168 |
173 |
" 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. |
169 |
174 |
nnoremap j gj |
170 |
175 |
nnoremap k gk |
171 |
176 |
" }}} |
172 |
177 |
|
173 |
178 |
" BACKING UP {{{ |
174 |
179 |
|
175 |
180 |
" What these lines do, is move the backup files to the /tmp folder. This will keep my directories clean and neat. |
176 |
181 |
set backup |
177 |
182 |
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp |
178 |
183 |
set backupskip=/tmp/*,/private/tmp/* |
179 |
184 |
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp |
180 |
185 |
set writebackup |
181 |
186 |
" }}} |
182 |
187 |
" |
183 |
188 |
" NEOVIM {{{ |
184 |
189 |
" While it certainly is an improvement over 'vanilla' Vim, it does some things |
185 |
190 |
" that keep me from using Vim as it's supposed to be; limited to no mouse usage. |
186 |
191 |
" So I disable it. I'll enable it again when I've twisted my mind far enough to |
187 |
192 |
" not touch my mouse again. (Not to mention some terminals don't support mouse |
188 |
193 |
" control, so it's a bad habit nonetheless if you spend all your time on |
189 |
194 |
" GNU/Linux distros) |
190 |
195 |
set mouse="" |
191 |
196 |
" }}} |
192 |
197 |
" |
193 |
198 |
" MACROS {{{ |
194 |
199 |
" }}} |
195 |
200 |
" OTHER IMPORTANT STUFF {{{ |
196 |
201 |
|
197 |
202 |
|
198 |
203 |
" 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. |
199 |
204 |
" Extensive explanation can also be found at https://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work#7078429 |
200 |
205 |
cmap w!! w !sudo tee > /dev/null % |
201 |
206 |
|
202 |
207 |
|
203 |
208 |
" This setting will allow me to switch to another buffer without need to save the current buffer. |
204 |
209 |
set hidden |
205 |
210 |
" }}} |
206 |
211 |
|
207 |
212 |
" Because Vim can fold vimrc files with the right syntax, These lines will tell Vim how to handle that. |
208 |
213 |
set modelines=2 "This tells Vim that the last 2 lines of this file should only apply to this file. |
209 |
214 |
" So as you can see, the last 2 lines get a special vim:-prefix, so Vim knows for sure this is what's important. |
210 |
215 |
" To wrap a new section, look at the other sections, and copy that syntax. |
211 |
216 |
" vim:foldmethod=marker |
212 |
217 |
" vim:foldlevel=0 |
213 |
218 |