-
Notifications
You must be signed in to change notification settings - Fork 1
/
_vimrc
356 lines (297 loc) · 8.89 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
set nocompatible
set rtp+=~/.vim
set rtp+=/home/linuxbrew/.linuxbrew/opt/fzf
call plug#begin('~/.vim/plugged')
" Plug '/usr/local/opt/fzf'
Plug 'aalvarado/my_snippets'
Plug 'airblade/vim-gitgutter'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'andymass/vim-matchup'
Plug 'bling/vim-airline'
Plug 'bronson/vim-visual-star-search'
" Plug 'cespare/vim-toml'
" Plug 'chr4/nginx.vim'
Plug 'cohama/lexima.vim'
" Plug 'dermusikman/sonicpi.vim'
Plug 'lilyinstarlight/vim-sonic-pi', { 'branch': 'main' }
Plug 'dracula/vim', { 'as': 'dracula' }
" Plug 'ianks/vim-tsx'
" Plug 'jparise/vim-graphql'
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-easy-align'
Plug 'kana/vim-textobj-user'
Plug 'nelstrom/vim-textobj-rubyblock'
" Plug 'kchmck/vim-coffee-script'
" Plug 'leafgarland/typescript-vim'
Plug 'lilydjwg/colorizer'
" Plug 'maxmellon/vim-jsx-pretty'
Plug 'michaeljsmith/vim-indent-object'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Plug 'ocaml/vim-ocaml'
" Plug 'plasticboy/vim-markdown'
Plug 'powerman/vim-plugin-AnsiEsc'
" Plug 'rust-lang/rust.vim'
" Plug 'reasonml-editor/vim-reason-plus'
Plug 'scrooloose/nerdcommenter'
Plug 'SirVer/ultisnips'
" Plug 'slim-template/vim-slim'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
" Plug 'tpope/vim-rails'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
" Plug 'vim-ruby/vim-ruby'
Plug 'whatyouhide/vim-textobj-erb'
" Plug 'yuezk/vim-js'
Plug 'sheerun/vim-polyglot'
Plug 'junegunn/goyo.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 {
"set shellcmdflag=-ic
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 on
" }
" Scroll {
set scrolloff=20
" }
" Visual {
set incsearch
set hlsearch
set laststatus=2
"set guioptions=i
set number
set ruler
"set shortmess=aIc
set shortmess=I
" 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
" }
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
" inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<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)
command! -nargs=0 Format :call CocAction('format')
command! -nargs=0 Prettier :CocCommand prettier.formatFile
" https://github.com/joshukraine/dotfiles/blob/ba4ac2969b91ed88f6413cdde05da251cf1906f9/nvim/init.vim
" rust
let g:rustfmt_autosave = 1
" }
" 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
" nmap <F9> :set ignorecase! ignorecase?
nnoremap ; :
nmap <silent> <leader>/ :nohlsearch<CR>
cmap cwd lcd %:p:h
"inoremap <s-enter> <cr><cr><up><tab>
nnoremap gs g^
nnoremap <Space> ;
nnoremap <s-Space> ,
inoremap jj <esc>
" cmap w!! %!sudo tee > /dev/null %
inoremap ,, <c-o>A,
inoremap ;; <c-o>A;<esc>
"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 <c-Space> <space>=><space>
nmap <C-]> :split<CR>:exec("tag ".expand("<cword>"))<CR>
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>
" 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
" 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"
nnoremap <silent><leader>w :w!<CR>
" optional reset cursor on start:
augroup myCmds
au!
autocmd VimEnter * silent !echo -ne "\e[2 q"
augroup END
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#21222C ctermbg=235
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#343746 ctermbg=237
" autocmd FileType html let b:coc_pairs_disabled = ['<']
" autocmd FileType eruby let b:coc_pairs_disabled = ['<']
"let $NVIM_COC_LOG_LEVEL = 'debug'
let g:coc_global_extensions = [
\ 'coc-css',
\ 'coc-docker',
\ 'coc-eslint',
\ 'coc-flow',
\ 'coc-git',
\ 'coc-godot',
\ 'coc-html',
\ 'coc-json',
\ 'coc-marketplace',
\ 'coc-prettier',
\ 'coc-reason',
\ 'coc-rls',
\ 'coc-solargraph',
\ 'coc-sql',
\ 'coc-stylelint',
\ 'coc-tag',
\ 'coc-toml',
\ 'coc-tslint',
\ 'coc-tslint-plugin',
\ 'coc-webpack',
\ 'coc-webpack',
\ 'coc-xml',
\ 'coc-yaml',
\]
autocmd filetype markdown set indentexpr=