-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
276 lines (235 loc) · 6.38 KB
/
vimrc
File metadata and controls
276 lines (235 loc) · 6.38 KB
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
" automatically reload vimrc when it's saved
"
au BufWritePost .vimrc so ~/.vimrc
"" Prepend mise shims to PATH
let $PATH = $HOME . '~/.local/share/mise/shims:' . $PATH
""
"" Plugins
""
if filereadable(expand("~/.vimrc.plugins"))
au BufWritePost .vimrc.plugins so ~/.vimrc.plugins
so ~/.vimrc.plugins
endif
""
"" Basic
""
set nocompatible
set number relativenumber
set noswapfile
syntax enable
set encoding=utf-8
set background=light
set incsearch
"set clipboard=unnamed " Now all operations work OS clipboard
set laststatus=2
:let mapleader=","
""
"" Colors
""
set colorcolumn=80
color Tomorrow-Night
hi ColorColumn ctermbg=darkgrey guibg=darkgrey
" Custom adjustments for color schemes.
" Run below to see how highlight colors are defined
" :so $VIMRUNTIME/syntax/hitest.vim
" link Statement to match Define, i.e. keywords in rspecs
hi! link Statement Define
hi Normal ctermbg=NONE guibg=NONE " remove the background
" disable Press Enter
set shortmess=at
""
"" Whitespace
""
set nowrap
set tabstop=2
set shiftwidth=2
set expandtab
set backspace=indent,eol,start
""
"" List
"" borrowed from https://github.com/carlhuda/janus/blob/master/janus/vim/core/before/plugin/settings.vim
""
set list
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
" off and the line continues beyond the left of the screen
""
"" File Extensions
""
au BufNewFile,BufRead *.md set filetype=markdown
""
"" IndentLine
""
let g:indentLine_char = '┆'
let g:indentLine_color_term = 233
" let g:indentLine_char_list = ['|', '¦', '┆', '┊']
""
"" Airline
""
let g:airline_powerline_fonts=1
" let g:airline_theme='powerlineish'
let g:airline_theme='bubblegum'
let g:airline#extensions#branch#displayed_head_limit = 12
let g:airline#extensions#ale#enabled = 1
""
"" TmuxLine
"
let g:airline#extensions#tmuxline#enabled = 0
let g:tmuxline_preset = ({
\ 'a': '#S',
\ 'win': '#I #W',
\ 'cwin': '#I #W',
\ 'z': ['%a', '%b %d', '%R'],
\ 'options': {
\'status-justify': 'centre'}
\})
""
"" Disable Arrow Keys
""
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
""
"" Searching
""
set hlsearch
"clear search hilights
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
""
"" GitGutter
""
" dummy sign so that the sign col is always present
:sign define dummy
:execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
" clean signColumn for https://github.com/airblade/vim-gitgutter
highlight clear SignColumn
""
"" Pane splitting
""
"Open splits below and to the right
" set splitbelow
" set splitright
""
"" VRoom
""
let g:vroom_use_vimux = 1
" let g:vroom_use_dispatch = 1
" let g:vroom_use_spring = 1
let g:vroom_use_binstubs = 1
" let g:vroom_command_prefix='docker compose exec api'
""
"" NERDTree
""
noremap <silent><Leader>n :NERDTreeToggle<CR>
""
"" Spelling
""
" Spell-check Git messages
autocmd FileType gitcommit setlocal spell
" Spell-check Markdown files
autocmd FileType markdown setlocal spell
""
"" ALE
""
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%severity%] %linter%::%code% %s'
let g:ale_hover_cursor = 1
let g:ale_pattern_options = {'Gemfile.lock': {'ale_enabled': 0}}
let g:ale_lint_delay = 400
let g:ale_fixers = { 'ruby': [ 'rubocop', ], }
" let g:ale_lint_on_text_changed = 'never'
" let g:ale_fixers = {'javascript': ['eslint']}
" let g:ale_completion_enabled = 1
" Fix files automatically on save
" let g:ale_fix_on_save = 1
""
"" fzf
""
nnoremap <C-p> :Files<CR>
nnoremap <Leader>b :Buffers<CR>
nnoremap <Leader>h :History<CR>
nnoremap <Leader>f :Rg<CR>
nnoremap <Leader>g :GFiles?<CR>
set grepprg=rg\ --vimgrep\ --smart-case\ --hidden\ --follow
" let g:rg_derive_root='true'
" https://github.com/junegunn/fzf.vim/pull/733#issuecomment-559720813
function! s:list_buffers()
redir => list
silent ls
redir END
return split(list, "\n")
endfunction
function! s:delete_buffers(lines)
execute 'bwipeout' join(map(a:lines, {_, line -> split(line)[0]}))
endfunction
command! BD call fzf#run(fzf#wrap({
\ 'source': s:list_buffers(),
\ 'sink*': { lines -> s:delete_buffers(lines) },
\ 'options': '--multi --reverse --bind ctrl-a:select-all+accept'
\ }))
""
"" Gutentags
""
" enable gtags module
" let g:gutentags_modules = ['ctags', 'gtags_cscope']
" generate datebases in my cache directory, prevent gtags files polluting my project
let g:gutentags_cache_dir = expand('~/.cache/tags')
" change focus to quickfix window after search (optional).
" let g:gutentags_plus_switch = 1
""
"" Snippets
""
let g:UltiSnipsExpandTrigger="<c-s>"
let g:UltiSnipsListSnippets="<c-b>"
" let g:UltiSnipsJumpForwardTrigger="<c-b>"
" let g:UltiSnipsJumpBackwardTrigger="<c-z>"
""
"" Auto Pairs
let g:AutoPairsFlyMode = 1
"" Ruby
""
" enable matchit to match ruby pairs
runtime macros/matchit.vi
""
"" Rspc
""
let g:rspec_command = "Dispatch bin/rspec {spec}"
""
"" Vim Wiki FZF
""
command! -bang VimwikiFzf call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case -- ".shellescape(<q-args>." ~/vimwikis"), 1, fzf#vim#with_preview(), <bang>0)
nmap <Leader>wp :VimwikiFzf<CR>
""
"" Backup and swap files
""
set backupdir^=~/.vim/_backup// " where to put backup files.
set directory^=~/.vim/_temp// " where to put swap files.
""
"" Misc
""
" execute current file
nnoremap <leader>e :!%:p<CR>
if has('nvim')
let g:perl_host_prog = '/Users/victor/.local/share/mise/installs/perl/latest/bin/perl'
" let g:python3_host_prog = '~/.local/share/mise/installs/python/latest/bin/python3'
let g:python3_host_prog = '/Library/Frameworks/Python.framework/Versions/3.12/bin/python3'
" let g:python3_host_prog = '~/.asdf/shims/python3'
set nowb
endif
""
"" Local config
""
if filereadable(expand("~/.dotfiles.local/vimrc"))
au BufWritePost .dotfiles.local/vimrc so ~/.dotfiles.local/vimrc
so ~/.dotfiles.local/vimrc
endif