-
Notifications
You must be signed in to change notification settings - Fork 4
/
.vimrc
426 lines (338 loc) · 11.2 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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
" -- plugin management --
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Manage thyself!
Plugin 'VundleVim/Vundle.vim'
Plugin 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" color themes
"Plugin 'NLKNguyen/papercolor-theme'
"Plugin 'romainl/Apprentice'
Plugin 'sainnhe/everforest'
"Plugin 'jacoborus/tender.vim'
"Plugin 'gosukiwi/vim-atom-dark'
"Plugin 'hardselius/warlock'
"Plugin 'Softmotions/vim-dark-frost-theme'
"Plugin 'axvr/raider.vim'
"Plugin 'axvr/photon.vim'
"Plugin 'neg-serg/neg.nvim'
Plugin 'brentlintner/twilighted.vim'
" Make themes work with transparent bg
Plugin 'tribela/vim-transparent'
" multi lang syntax support
"Plugin 'sheerun/vim-polyglot'
Plugin 'kchmck/vim-coffee-script'
"Plugin 'pangloss/vim-javascript'
" Rails
"Plugin 'tpope/vim-bundler'
"Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-rails'
" shows which lines have been added, modified, or removed
Plugin 'airblade/vim-gitgutter'
" support for EditorConfig
Plugin 'editorconfig/editorconfig-vim'
" highlighting of keywords vs values, warnings, and quote concealing
Plugin 'elzr/vim-json'
" make gvim-only colorschemes work transparently in terminal
Plugin 'godlygeek/csapprox'
" css/less/sass/html color preview
"Plugin 'gorodinskiy/vim-coloresque'
" Fuzzy file, buffer, mru, tag, etc finder
Plugin 'ctrlpvim/ctrlp.vim'
" support creating gists from buffers
"Plugin 'mattn/webapi-vim'
"Plugin 'mattn/gist-vim'
" support for Ack
Plugin 'mileszs/ack.vim'
" highlight trailing whitespace characters
Plugin 'ntpeters/vim-better-whitespace'
" auto comment support
Plugin 'scrooloose/nerdcommenter'
" file system explorer
Plugin 'scrooloose/nerdtree'
" dev icons!
Plugin 'ryanoasis/vim-devicons'
" support nerdtree icons
"Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
" helps to end certain code structures automatically
Plugin 'tpope/vim-endwise'
" change surrounding quotes, etc
Plugin 'tpope/vim-surround'
" run tests for Ruby
"Plugin 'kurko/smartest.vim'
" code snippets
"Plugin 'sirver/ultisnips'
"Plugin 'honza/vim-snippets'
" smart lookups
Plugin 'neoclide/coc.nvim', { 'branch': 'release' }
" show lsp symbols in pane
"Plugin 'liuchengxu/vista.vim'
Plugin 'brentlintner/vista.vim'
" better terminal
" Plugin 'kassio/neoterm'
" auto linting
Plugin 'dense-analysis/ale'
" markdown plugin
"Plugin 'godlygeek/tabular'
"Plugin 'plasticboy/vim-markdown'
" git integration (blame, etc)
Plugin 'tpope/vim-fugitive'
Plugin 'rhysd/git-messenger.vim'
Plugin 'slim-template/vim-slim'
" thanks octref!
Plugin 'brentlintner/RootIgnore'
" AI!
Plugin 'github/copilot.vim'
call vundle#end()
" -- main config --
set shell=/bin/zsh
"set shell=/usr/bin/zsh
"set shell='cmd.exe'
let g:loaded_ruby_provider = 0
let g:loaded_node_provider = 0
" color and syntax settings
let g:everforest_transparent_background = 1
let g:transparent_groups = ['Normal', 'Comment', 'Constant', 'Special', 'Identifier',
\ 'Statement', 'PreProc', 'Type', 'Underlined', 'Todo', 'String',
\ 'Function', 'Conditional', 'Repeat', 'Operator', 'Structure',
\ 'LineNr', 'NonText', 'SignColumn', 'CursorLineNr', 'EndOfBuffer',
\ 'StatusLine', 'StatusLineNC' ]
let g:transparent_groups += ['Pmenu']
let g:transparent_groups += ['CtrlPMode1', 'CtrlPMode2', 'CtrlPStats'] " CtrlP
let g:transparent_groups += ['NormalFloat'] " coc.nvim
syntax on
set t_Co=256
set termguicolors
set background=dark
colorscheme everforest
hi Normal guibg=NONE ctermbg=NONE
hi VertSplit guifg=#262626 guibg=NONE ctermfg=235 ctermbg=NONE
set nowrap
"set wildignore+=*/build/,.DS_Store,log,*public/assets/*,*/.build/*,*coverage/*,*coverage_js/*,*.idea*,*.gradle/*,*/dist/*,*android/build/*,*app/build/*,*assets/builds/*,*build/lib*,*.docs*,*/.test*,*.tscache*,*.git/*,*node_modules/*,*bower_components/*,*.vim/bundle,*tmp/*,*.cabal-sandbox/*,*.keep
" import .gitignore into wildignore when inside a git repo folder structure
let g:RootIgnoreUseHome = 1
let g:RootIgnoreAgignore = 0
" ctrl-p
" TODO: clear cache on pull up? map new key?
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_max_files = 0
let g:ctrlp_show_hidden = 1
let g:ctrlp_working_path_mode = '0'
let g:ctrlp_clear_cache_on_exit = 1
" Use ag and .ignore file for ctrlp
let g:ctrlp_user_command = [
\ '.git',
\ 'ag %s -U -f --hidden --nocolor -g ""'
\ ]
"let g:ctrlp_custom_ignore = {
"\ 'dir' : 'node_modules|\.git$|\.hg$|\.svn$',
"\ 'file': '',
"\ }
nnoremap <silent> <C-n> :CtrlPBuffer<CR>
"nnoremap <silent> <C-t> :CtrlPTag<CR>
let g:python3_host_prog = '/usr/bin/python3'
let g:pip3_host_prog = '/usr/bin/pip3'
" CoC settings
let g:coc_global_extensions=[
\ 'coc-tsserver',
\ 'coc-solargraph',
\ 'coc-phpls',
\ 'coc-html',
\ 'coc-css',
\ 'coc-vetur',
\ 'coc-flutter',
\ 'coc-vimlsp',
\ 'coc-go',
\]
" TODO: map tab to complete (else tab)?
inoremap <silent><expr> <cr> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
inoremap <silent><expr> <C-n> coc#pum#visible() ? coc#pum#next(1) : "\<C-n>"
inoremap <silent><expr> <C-p> coc#pum#visible() ? coc#pum#prev(1) : "\<C-p>"
nmap <silent> gh :call CocAction('doHover')<CR>
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)
"nnoremap <silent> <C-e><C-p> :CocOutline<CR>
nnoremap <silent> <C-e><C-p> :Vista!!<CR>
nnoremap <silent> <C-e><C-l> :CocDiagnostics<CR>
"imap <C-0> <Plug>(copilot-next)
"imap <C-[> <Plug>(copilot-previous)
"imap <C-]> <Plug>(copilot-suggest)
"imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
"let g:copilot_no_tab_map = v:true
" vista
let g:vista#renderer#enable_icon = 0
let g:vista_default_executive = 'coc'
let g:vista_sidebar_width = 40
let g:vista_floating_delay = 100
let g:vista_update_on_text_changed = 1
let g:vista_update_on_text_changed_delay = 0
let g:vista_blink = [0, 0]
let g:vista_echo_cursor = 0
let g:vista_echo_cursor_strategy = 'floating_win'
let g:vista_cursor_delay = 0
let g:vista_disable_statusline = 1
let g:vista_highlight_whole_line = 1
let g:vista_fzf_preview = ['right:50%']
let g:vista_enable_centering_jump = 0
let g:vista_find_nearest_method_or_function_delay = 0
" git gutter
let g:gitgutter_set_sign_backgrounds = 0
hi SignColumn guibg=NONE ctermbg=NONE
" ale
let g:ale_disable_lsp = 1
let g:ale_sign_column_always = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 1
let g:ale_virtualtext_cursor = 'disabled'
let g:ale_linters = {
\ 'ruby': ['rubocop'],
\ 'typescript': ['eslint'],
\}
hi ALEErrorSign guibg=NONE ctermbg=NONE
hi ALEWarningSign guibg=NONE ctermbg=NONE
" speed up vue plugin
let g:vue_disable_pre_processors = 1
" disable optional perl module
let g:loaded_perl_provider = 0
" set snippet keys
"let g:UltiSnipsExpandTrigger="<tab>"
"let g:UltiSnipsJumpForwardTrigger="<c-b>"
"let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"let g:UltiSnipsEditSplit="vertical"
"nmap <leader>S :UltiSnipsEdit<cr>
" enable clipboard
if system('uname -s') == "Darwin\n"
set clipboard=unnamed "OSX
else
set clipboard=unnamedplus "Linux
endif
" use silver searcher underneath ack.vim
let g:ackprg = 'ag -U -f --hidden --vimgrep'
command! -nargs=1 Ag Ack <args>
command! -nargs=1 -complete=file -bar Acks Ag! <args>|cw
nmap <leader>g :Ag<space>
" disable vim-markdown folder
let g:vim_markdown_folding_disabled=1
" gist-vim
let g:gist_detect_filetype = 1
let g:gist_post_private = 1
set backspace=indent,eol,start " backspacing support
set foldmethod=indent
set foldlevel=99
" Fast saving (\w)
nmap <leader>w :wa<cr>
" Fast saving (leader free)
noremap <C-w>w :wa<CR>
nmap <leader>t :execute ":!bundle exec rails test %:" . line('.')<CR>
nmap <leader>T :execute ":!bundle exec rails test %"<CR>
"nmap <leader>T :!bundle exec rails test:all<CR>
set ignorecase " Ignore case when searching
set smartcase " When searching try to be smart about cases
set hlsearch " Highlight search resultsh
set incsearch " be like search in modern browsers
" Enable mouse (if terminal has support for it)
if has('mouse')
set mouse=a
endif
set ruler " Always set the mouse cursor position
" Turn off backups, etc.
set nobackup
set nowritebackup
set nowb
set noswapfile
" Disable wrapping
"set nowrap
" Allow switching between buffers without saving .
set hidden
" Show hybrid line numbers except when out of focus or in Insert
:set number
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
:augroup END
" Set xterm title.
set title
" Highlight char when over textwidth
highlight ColorColumn ctermbg=red
call matchadd('ColorColumn', '\%121v', 120)
" Indentation settings..
set autoindent
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set scrolloff=1
"set expandtab
" Map space to search
map <space> /
" Easier way to move between windows.
" Apparenty (ATM), Neovim sends <BS> vs ^H
" https://github.com/neovim/neovim/issues/2048#issuecomment-77159983
if has('nvim')
nmap <BS> <C-W>h
endif
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" TypeScript config
let g:typescript_compiler_binary = 'npx tsc'
let g:typescript_compiler_options = ''
" Show git blame
nmap <leader>b :GitMessenger<CR>
nmap <leader>B :Git<space>blame<CR>
nmap <leader>l :0Gclog<CR>
"let g:git_messenger_floating_win_opts = { 'border': 'single' }
let g:git_messenger_no_default_mappings = v:true
" window and neoterm commands
" TODO: use leader vs C where possible
nmap <C-c> :close<CR>
"nmap <leader>z :TcloseAll! \| :T<space>
nmap <C-w>c :bd<CR>
"nmap <leader>C :TcloseAll!<CR>
"nmap <leader>t :TcloseAll! \| :T npm t %<cr>
"nmap <leader>T :TcloseAll! \| :T ./vendor/bin/phpunit %<cr>
"let g:neoterm_default_mod = 'botright'
" Clear whitespace
let g:better_whitespace_enabled=1
" Make sure it always shows
set laststatus=2
" Resize windows
nnoremap <Leader>- :vertical resize -5<CR>
nnoremap <Leader>= :vertical resize +5<CR>
" NERD Tree
let g:NERDTreeShowHidden = 1
let g:NERDTreeIgnore = []
let g:NERDTreeHighlightCursorline = 0
let g:NERDTreeMinimalUI=1
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
let g:WebDevIconsNerdTreeBeforeGlyphPadding = ''
"let g:WebDevIconsDisableDefaultFolderSymbolColorFromNERDTreeDir = 1
"let g:WebDevIconsDisableDefaultFileSymbolColorFromNERDTreeFile = 1
nnoremap <silent> <C-e><C-f> :NERDTreeToggle<CR>
" different split
"nnoremap <C-w>e :split<CR>
nnoremap <C-w>v :vsplit<CR>
" Spellcheck en_CA
nnoremap <C-w>p :setlocal spell spelllang=en_ca<CR>
nnoremap <C-w>P :setlocal nospell<CR>
" Clear search
nnoremap <C-w><space> :let @/ = ""<CR>
map <leader><space> :let @/ = ""<CR>
map <silent> <leader><cr> :noh<cr>
" highlighting aliases
au BufRead,BufNewFile *.plist set filetype=xml
au BufRead,BufNewFile *.gpx set filetype=xml
" if on Windows Terminal
" nnoremap <c-z> <nop>
if !has('nvim')
" Need +virtualedit to paste in insert mode.
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
imap <S-Insert> <C-V>
vmap <S-Insert> <C-V>
endif