-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
322 lines (215 loc) · 6.17 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
" === Reset & Basic settings ============================================ {{{
"
set nocompatible | " vim only
set modelines=0
set ttyfast
if has('mouse')
set mouse=a
endif
set encoding=utf-8
set autoread | "au CursorHold * checktime | " autoreload file on external changes
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
" }}}
" === Autoinstall VimPlug ================================================ {{{
"
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
if has("autocmd")
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endif
" NOTE: VimPlug automatically executes:
" - filetype plugin indent on
" - syntax enable
" }}}
" === Autoinstall missing Plugins on startup ============================= {{{
"
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
" }}}
" === Vim Plugins ======================================================== {{{
"
call plug#begin('~/.vim/plugged')
" Make terminal cursor change based on vim modes
Plug 'wincent/terminus'
" VimAirline; must be always before Devicons
Plug 'vim-airline/vim-airline'
" Vim IndentGuides
Plug 'thaerkh/vim-indentguides'
" Set project custom indentation
Plug 'editorconfig/editorconfig-vim'
" CtrlP
Plug 'ctrlpvim/ctrlp.vim'
" Complete with TAB
Plug 'ajh17/VimCompletesMe'
"Vim plugin for intensely nerdy commenting power
Plug 'preservim/nerdcommenter'
" NERDTree is a file system explorer for the Vim editor.
Plug 'preservim/nerdtree'
" Vim Devicons; add icons to other plugins
Plug 'ryanoasis/vim-devicons'
" repeat.vim: enable repeating supported plugin maps with "."
Plug 'tpope/vim-repeat'
" A git wrapper
Plug 'tpope/vim-fugitive'
" Search for Tasks: TODO, FIXME
Plug 'gilsondev/searchtasks.vim'
" ALE (Asynchronous Lint Engine)
Plug 'dense-analysis/ale'
" Vim Terminal in an interactive buffer
"Plug 'tc50cal/vim-terminal'
" Trebuie verificat
" Plug 'bagrat/vim-buffet'
Plug 'majutsushi/tagbar'
call plug#end()
" }}}
" === VIMRC Settings ===================================================== {{{
"
"
if has ('autocmd')
" autoreload vimrc on save {{{
augroup vimrc
autocmd! BufWritePost $MYVIMRC
\ source $MYVIMRC
\| redraw
\| echom "Reloaded " . $MYVIMRC
augroup END
" }}}
" enable folding for vimrc {{{
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
autocmd FileType vim setlocal foldlevel=1
augroup END
" }}}
endif
" }}}
" === Colors settings ==================================================== {{{
"
" Allow color scheme to do bright colors without forcing bold
if &t_Co == 8 && $TERM !~# '^Eterm'
set t_Co=16
endif
" We set this again
" because striped version of vi has no autocmd or plugin support
syntax enable
" }}}
" === Spaces and Tab settings ============================================ {{{
"
" this settings will be overwritten by editorconfig-vim plugin
set tabstop=4
set softtabstop=4
set expandtab
set shiftround
set shiftwidth=4
set smarttab
set autoindent
set backspace=indent,eol,start
" }}}
" === UI Config ========================================================== {{{
"
set number
set relativenumber
set cursorline
" We set this again
" because striped version of vi has no autocmd or plugin support
filetype indent on
set showcmd
set laststatus=2
set showtabline=2
set ruler
set wildmenu
set wildmode=list:longest,full
set showmatch
if has("autocmd")
set showmode | " show mode when running on vi, otherwise we have airline
endif
if (has("termguicolors"))
set termguicolors
endif
set background=dark
" }}}
" === Searching ========================================================= {{{
"
set incsearch
set hlsearch
set ignorecase
set smartcase
" }}}
" === Folding settings =================================================== {{{
"
"
" }}}
" === Plugin Settings ==================================================== {{{
"
" Vim-Airline Settings {{{
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" }}}
" Vim IndentGuides settings {{{
let g:indentguides_ignorelist = ['txt', 'help']
let g:indentguides_spacechar = ''
let g:indentguides_tabchar = ''
" }}}
" Close Vim if NerdTree is the only window left open {{{
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" }}}
"let g:buffet_powerline_separators = 1
"let g:buffet_tab_icon = "\uf00a"
"let g:buffet_left_trunc_icon = "\uf0a8"
"let g:buffet_right_trunc_icon = "\uf0a9"
" }}}
" Search Tasks plugin configuration {{{
" List occurrences for search
let g:searchtasks_list=["TODO", "FIXME", "XXX"]
"}}}
" ALE settings {{{
let g:airline#extensions#ale#enabled = 1
" }}}
" === File settings ===================================================== {{{
"
" go last position in file after reopen {{{
:au BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
" }}}
" reopen last state of folds {{{
augroup remember_folds_status
autocmd!
au BufWinLeave ?* mkview 1
au BufWinEnter ?* silent! loadview 1
augroup END
" }}}
" }}}
" === Custom Key Bindings ================================================ {{{
"
nnoremap F gg=G'' | " Shift + F to autoindent file
nnoremap <leader>tn :call NumberToggle()<cr> | " toggle relative file numbers
nnoremap <leader><space> :nohlsearch<CR> | " turn off search highlight
" }}}
" === Custom Functions =================================================== {{{
"
" RelativeNumber Toggle {{{
function! NumberToggle()
if(&relativenumber == 1)
set norelativenumber
else
set relativenumber
endif
endfunc
" }}}
" }}}
" === Reset settings ===================================================== {{{
"
"
" }}}
" === Reset settings ===================================================== {{{
"
"
" }}}