-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
378 lines (318 loc) · 9.27 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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
" Prevents issues with terminals
set t_u7=
set nocompatible
set rtp+=~/.vim
" set rtp+=/home/linuxbrew/.linuxbrew/opt/fzf
call plug#begin('~/.vim/plugged')
Plug 'aalvarado/my_snippets'
Plug 'airblade/vim-gitgutter'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'andymass/vim-matchup'
Plug 'bling/vim-airline'
Plug 'haya14busa/vim-asterisk'
Plug 'qxxxb/vim-searchhi'
" Plug 'dermusikman/sonicpi.vim'
Plug 'lilyinstarlight/vim-sonic-pi', { 'branch': 'main' }
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-easy-align'
Plug 'kana/vim-textobj-user'
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'lilydjwg/colorizer'
Plug 'michaeljsmith/vim-indent-object'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'powerman/vim-plugin-AnsiEsc'
Plug 'prisma/vim-prisma'
Plug 'preservim/nerdcommenter'
Plug 'SirVer/ultisnips'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'vim-ruby/vim-ruby'
Plug 'whatyouhide/vim-textobj-erb'
Plug 'sheerun/vim-polyglot'
Plug 'junegunn/goyo.vim'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
Plug 'elkowar/yuck.vim'
call plug#end()
if has('win32') || has('win64')
set clipboard=unnamed
set shell=cmd.exe
set shellxquote=
endif
if has('unix')
set clipboard=unnamedplus
endif
" General {
filetype plugin on
setglobal nobomb
set autoindent
set whichwrap=b,s,h,l,<,>,[,]
set backspace=indent,eol,start
set encoding=utf-8
set expandtab
set fileformats=unix
set fileencoding=utf-8
set ignorecase
set hidden
set history=1000
set hlsearch
set mouse=a
set noswapfile
set shiftwidth=2
set showcmd
set softtabstop=2
set smartcase
set tabstop=2
set wildmenu
set wildmode=list:longest
set synmaxcol=500
set nomodeline
let mapleader = ','
set cmdheight=2
syntax enable
" }
" Scroll {
set scrolloff=20
" }
" Visual {
set incsearch
set hlsearch
set laststatus=2
set number
set ruler
set shortmess=Ic
" Wrapping options
set wrap
set lbr
let &showbreak = '↳ '
set breakindentopt=shift:2,min:40,sbr
set breakindent
let &breakat = " \t;,])}"
" }
set belloff=all
if has("autocmd") && has("gui")
au GUIEnter * set t_vb=
endif
" Plugins {
let g:NERDSpaceDelims = 1
let g:NERDDefaultAlign = 'left'
let g:matchup_matchparen_deferred = 1
let g:matchup_surround_enabled = 1
let g:dracula_bold = 0
let g:dracula_italic = 0
let g:dracula_colorterm = 0
colorscheme dracula
set rtp+=~/.vim/plugged
let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/plugged/my_snippets']
let g:UltiSnipsEditSplit="horizontal"
let g:UltiSnipsJumpBackwardTrigger = "<c-l>"
hi Normal ctermbg=NONE
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size = 1
let g:indent_guides_auto_colors = 0
call airline#parts#define_accent('mode', 'none')
call airline#parts#define_accent('linenr', 'none')
call airline#parts#define_accent('maxlinenr', 'none')
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_splits = 0
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#branch#displayed_head_limit = 8
let g:airline#extensions#hunks#enabled = 0
let g:airline_inactive_alt_sep=1
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
let g:airline_mode_map = {
\ '__' : '-',
\ 'c' : 'C',
\ 'i' : 'I',
\ 'ic' : 'I',
\ 'ix' : 'I',
\ 'n' : 'N',
\ 'multi' : 'M',
\ 'ni' : 'N',
\ 'no' : 'N',
\ 'R' : 'R',
\ 'Rv' : 'R',
\ 's' : 'S',
\ 'S' : 'S',
\ '' : 'S',
\ 't' : 'T',
\ 'v' : 'V',
\ 'V' : 'V',
\ '' : 'V',
\ }
let g:surround_35 = "#{\r}" " #
" AnsiEsc
" disables <leader>,rwp
let g:no_cecutil_maps = 1
" Gitgutter <leader> h disable
let g:gitgutter_map_keys = 0
" }
" CoC
set updatetime=300
inoremap <silent><expr> <a-\> coc#refresh()
" Use K to show documentation in preview window
nnoremap <silent> K :call ShowDocumentation()<CR>
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
inoremap <expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<CR>"
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Remap keys for gotos
nmap <silent>gd <Plug>(coc-definition)
nmap <silent>gy <Plug>(coc-type-definition)
nmap <silent>gi <Plug>(coc-implementation)
nmap <silent>gr <Plug>(coc-references)
" Remap keys for applying codeAction to the current line.
nmap <leader>ac <Plug>(coc-codeaction)
nmap <leader>qf <Plug>(coc-fix-current)
nnoremap <silent> <leader>h :call CocActionAsync('doHover')<cr>
command! -nargs=0 Format :call CocAction('format')
command! -nargs=0 Prettier :CocCommand prettier.formatFile
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
" rust
let g:rustfmt_autosave = 1
" }
" Markdown {
" let g:vim_markdown_auto_insert_bullets = 1
" let g:vim_markdown_new_list_item_indent = 0
" }
" Customizations {
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 0
let g:netrw_altv = 1
let g:netrw_winsize = 25
" Add date
nmap <silent> <leader>ad :r !date +\%F<CR>
" nmap <F9> :set ignorecase! ignorecase?
nnoremap ; :
nmap <silent> <leader>/ :nohlsearch<CR>
cmap cwd lcd %:p:h
cmap vrc tabe ~/.vimrc<cr>
cmap sov source ~/.vimrc
cmap vi3 tabe ~/.i3/config<cr>g;
cmap via tabe ~/.bash_aliases<cr>
cmap jj <esc>
" ^ is too far
nnoremap \ g^
vnoremap \ g^
nnoremap d\ d^
inoremap <c-\> <esc>c^
" inoremap <s-CR> <CR><CR><c-o><up><tab>
inoremap <a-enter> <cr><cr><c-o><up><tab>
nnoremap <Space> ;
nnoremap <s-Space> ,
inoremap jj <esc>
" Double comma to add a comma to the end
inoremap ,, <c-o>A,
inoremap ;; <c-o>A;<esc>
" //e means continue even with errors *:s_e*
command! -nargs=0 StripWhitespace :%s/\s\+$//e
nnoremap <leader>sw :StripWhitespace<CR>
inoremap {<CR> {<CR>}<c-o>O
inoremap (<CR> (<CR>)<c-o>O
inoremap [<CR> [<CR>]<c-o>O
" inoremap <s-CR> <CR><CR><c-o><up><tab>
" inoremap '''<cr> '''<cr>'''<c-o><up><tab>
" Search in selected lines
vnoremap <M-k> <Esc>/\%V
" nnoremap <M-l> :BLines<CR>
vnoremap <c-p> "ry:<c-u>Rg <c-r>r<cr>
nnoremap <c-p> :Rg<space>
" FZF commands
nmap <silent> <leader>fr :e %:h<CR>
nmap <silent> <leader>fb :Buffers<CR>
nmap <silent> <leader>ff :Files<CR>
nmap <silent> <leader>fg :GFiles<CR>
nmap <silent> <leader>fh :History<CR>
nmap <silent> <leader>fl :BLines<CR>
nmap <silent> <leader>fv :Lex %:p:h<CR>
nmap <leader>; <c-w><c-w>
nmap <silent> <leader>x :x<CR>
nmap <silent> <leader>o :on<cr>
nmap <silent> <leader>ue :UltiSnipsEdit<cr>
nmap <silent> <leader>rc :source ~/.vimrc<cr>
" Yank current file path from cwd
nmap <leader>yp :let @+=expand("%:.")<CR>
:hi Normal ctermbg=NONE
:hi MatchWord ctermfg=NONE guifg=NONE cterm=underline gui=underline
fu! FreezeHeader()
execute '1sp'
execute 'bp'
endf
" let g:sonic_pi_command = 'sonic-pi-tool.py'
" let g:sonic_pi_autolog_enabled = 0
" let g:sonic_pi_check = 'version'
" let g:sonic_pi_eval = ''
" let g:sonic_pi_stop = 'stop'
" Disabled due to lack of support
" let g:sonic_pi_run = ''
" let g:sonic_pi_logs = ''
" let g:sonic_pi_record = ''
let g:vim_redraw = 1
set t_Co=256
set notermguicolors
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
" Quicker save just ,w and will write the file
nnoremap <silent><leader>w :w!<CR>
" Fix indent lines odd color in terminals
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#21222C ctermbg=235
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#343746 ctermbg=237
let g:coc_global_extensions = [
\ 'coc-css',
\ 'coc-docker',
\ 'coc-eslint',
\ 'coc-git',
\ 'coc-godot',
\ 'coc-html',
\ 'coc-json',
\ 'coc-lists',
\ 'coc-marketplace',
\ 'coc-prettier',
\ 'coc-prisma',
\ 'coc-rust-analyzer',
\ 'coc-solargraph',
\ 'coc-sql',
\ 'coc-stylelint',
\ 'coc-tag',
\ 'coc-toml',
\ 'coc-tsserver',
\ 'coc-vimlsp',
\ 'coc-webpack',
\ 'coc-webpack',
\ 'coc-xml',
\ 'coc-yaml',
\]
fu! SetSpell()
setlocal spell spelllang=en_us
endf
" Don't touch my indent
autocmd filetype markdown set indentexpr=
autocmd filetype markdown call SetSpell()
autocmd filetype typescript set indentexpr=
" autocmd filetype javascript set indentexpr=
" autocmd filetype css set indentexpr=
inoremap <c-Space> <space>=><space>
autocmd filetype rust inoremap <buffer> <c-Space> <space>-><space>
autocmd FileType prisma syntax sync fromstart
" autocmd filetype ruby inoremap <buffer> <c-Space> <space>=><space>
"let $NVIM_COC_LOG_LEVEL = 'debug'
"
" nnoremap <a-j> <c-w><c-j>
" nnoremap <a-k> <c-w><c-k>
" nnoremap <a-l> <c-w><c-l>
" nnoremap <a-h> <c-w><c-h>