-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstandard_nvimrc
717 lines (554 loc) · 19.8 KB
/
standard_nvimrc
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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
set nocompatible
filetype off
" isolate neovim bundles and plugins from vim's
if has('nvim')
let s:editor_root=expand("~/.nvim")
else
let s:editor_root=expand("~/.vim")
endif
" Disable using ALE for LSP so that coc.nvim or built in LSP server can do it instead
let g:ale_disable_lsp = 1
" Begin vim-plug configuration, see https://github.com/junegunn/vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
" ===== START Plug BUNDLES =======
" == Themes
Plug 'altercation/vim-colors-solarized'
Plug 'freeo/vim-kalisi'
Plug 'drewtempelmeyer/palenight.vim'
Plug 'ayu-theme/ayu-vim'
Plug 'nanotech/jellybeans.vim'
Plug 'mdlerch/vim-tungsten'
Plug 'sainnhe/vim-color-forest-night'
Plug 'gruvbox-community/gruvbox'
Plug 'Tsuzat/NeoSolarized.nvim', { 'branch': 'master'}
Plug 'catppuccin/nvim'
Plug 'rebelot/kanagawa.nvim'
Plug 'eddyekofo94/gruvbox-flat.nvim'
Plug 'sainnhe/vim-color-forest-night'
Plug 'junegunn/seoul256.vim'
Plug 'habamax/vim-gruvbit'
Plug 'romainl/Apprentice'
Plug 'NLKNguyen/papercolor-theme'
Plug 'projekt0n/caret.nvim'
" == Functionality
Plug 'vim-airline/vim-airline'
Plug 'christoomey/vim-tmux-navigator'
" ALE and coc.nvim for linting and diagnostics
" https://github.com/dense-analysis/ale#faq-coc-nvim
" https://github.com/neoclide/coc.nvim
"Plug 'dense-analysis/ale'
"Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
Plug 'jeetsukumaran/vim-buffergator'
Plug 'xolox/vim-misc'
Plug 'tpope/vim-surround'
Plug 'Raimondi/delimitMate'
Plug 'preservim/nerdcommenter'
"Plug 'vim-syntastic/syntastic'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'ekalinin/Dockerfile.vim'
Plug 'elzr/vim-json'
Plug 'leafgarland/typescript-vim'
"Plug 'davidhalter/jedi-vim'
Plug 'mattn/emmet-vim'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'hzchirs/vim-material'
Plug 'sheerun/vim-polyglot'
Plug 'majutsushi/tagbar'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
""" Rust plugins
" Collection of common configurations for the Nvim LSP client
Plug 'rust-lang/rust.vim'
Plug 'neovim/nvim-lspconfig'
" Completion framework
Plug 'hrsh7th/nvim-cmp'
" LSP completion source for nvim-cmp
Plug 'hrsh7th/cmp-nvim-lsp'
" Snippet completion source for nvim-cmp
Plug 'hrsh7th/cmp-vsnip'
" Other usefull completion sources
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-buffer'
" To enable more of the features of rust-analyzer, such as inlay hints and more!
Plug 'simrat39/rust-tools.nvim'
" Snippet engine
Plug 'hrsh7th/vim-vsnip'
" ===== END Plug BUNDLES =========
call plug#end()
" Based on partially on .vimrc file from http://www.stripey.com/vim/vimrc.html
" Enable filetype detection
filetype plugin indent on
syntax enable
" set hidden hides buffers instead of closing them. This means you can have
" unwritten changes to a file and open a new file using :e without being
" forced to commit a write or undo your changes to the first file. Also,
" undo buffers and marks are preservede while the buffer is open.
set hidden
" Map/remap the leader keybinding
:let mapleader = ","
" :let mapleader = ";"
" set ms-windows behavior, see :help :behave to see exactly what this does
behave mswin
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Set default color scheme
set t_Co=256
if has('gui_running')
set background=light
else
set background=light
endif
"colorscheme vim-material
"let g:material_style='oceanic'
"let g:airline_theme='material'
colorscheme gruvbox
"colorscheme gruvbox-flat
set termguicolors " enable true colors support
"let ayucolor="light" " for light version of theme
"let ayucolor="mirage" " for mirage version of theme
"let ayucolor="dark" " for dark version of theme
"colorscheme ayu
" Set encoding to utf-8, just in case
"set encoding=utf-8
" if this is gvim, turn off toolbar by default
:set guioptions-=T
" First things first, let's clear out any existing autocommands shall we?
autocmd!
" Set vim's current working directory to the directory of the file you're
" opening.
autocmd BufEnter * lcd %:p:h
" Ensure there is at least one line of space below cursor
if !&scrolloff
set scrolloff=1
endif
" Autoload file changes. Undo this by pressing 'u'
set autoread
" Now setting a command line history of 50 lines
set history=50
" And showing the cursor positionat all times
set ruler
" Highlight current line with autocmd so that highlight is only applied in
" current window
" http://vim.wikia.com/wiki/Highlight_current_line
"set cursorline
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
" Highlight current column
" set cursorcolumn
" ignore case in search, display line numbers, display current mode and
" partially typed commands in status line
set showmode
set showcmd
set ignorecase
set number
set number relativenumber "See post on relative number lining http://blog.petrzemek.net/2016/04/06/things-about-vim-i-wish-i-knew-earlier/
"use plugin vim-numbertoggle to manage linenumbers
" We don't need Vim to write a backup file; there are better ways to backup
" than to rely on Vim
set nobackup
set noswapfile
" Disable safe write feature, since this may confound the file watcher for
" webpack: https://webpack.github.io/docs/webpack-dev-server.html#working-with-editors-ides-supporting-safe-write
set backupcopy=yes
" set pastetoggle to F2 so that when it's on and you paste, Vim doesn't
" apply autoindenting and other crap which you don't need when pasting
"set pastetoggle=<F2>
" https://dev.to/vintharas/5-minutes-vim-ctrlp-considered-harmful-48eg
" and https://pragmaticpineapple.com/improving-vim-workflow-with-fzf/
"noremap <C-p> :<C-u>FZF<CR>
noremap <C-p> :GFiles<CR>
" Note that file preview window syntax highlight theme is determined by
" ~/.config/bat/config and you can get a list of all themes with
" `bat --list-themes`
" set 'd' to be delete and leader 'd' as cut.
" https://stackoverflow.com/questions/11993851/how-to-delete-not-cut-in-vim
nnoremap x "_x
nnoremap d "_d
nnoremap D "_D
vnoremap d "_d
nnoremap <leader>d ""d
nnoremap <leader>D ""D
vnoremap <leader>d ""d
" enable mouse, to disable, set mouse to -a instead of a
" set mouse=a
:set mouse=a
" turn on syntax highlighting
if has('syntax')
syntax on
endif
" briefly flash the matching brace/parenthesis/bracket when you type
" a closing or opening brace/parenthesis/bracket. Awesome? Awesome.
set showmatch
" Let's also make sure rainbow highlighting is turned on for Lisp
let g:lisp_rainbow = 1
" speaking of brief flashes, how about we get rid of those annoying
" beeps and replace them with brief screen flashes when a command doesn't work.
set vb t_vb=
" command-line completion <Tab> (ie. filenames, help topics, option names)
" lists available options and completes the longest common part, then
" further <Tab>s will cycle through possibilities
set wildmode=list:longest,full
" displays status line that shows name of file currently being edited
" as well as whether or not it has been modified since opening.
set laststatus=2
" Increase message size so vim won't show 'press enter to continue' prompts
" http://vim.wikia.com/wiki/Avoiding_the_%22Hit_ENTER_to_continue%22_prompts
:set shortmess=aoOtI
" ---------
" GVIM Window settings
if has("gui_running")
set lines=40
set columns=80
endif
" ---------
" Treat lines with quote mark as comments
set comments+=b:\"
" Let's show the best match so far as we type
set incsearch
" Show whitespace and tabs
:set list
:set listchars=tab:>-,trail:~,extends:>,precedes:<
" -----------------
" Tabs and formatting
" indents of 4 characters (NO SPACES), smart and auto-indent are on,
" indents are copied down lines
" set nowrap " turn off line wrapping
set formatoptions=l " turn on word wrapping
set lbr " make sure word wrapping doesn't break in middle of words
set shiftwidth=2 " how much to auto-indent by
set ts=2 " sets tab stops to whatever for text input
set expandtab " turn tab keypresses into spaces (set this or the one below, NOT BOTH)
"set noexpandtab " leave tab keys as real tabs (either set this or the above)
set shiftround
set autoindent
set nosmartindent
filetype plugin indent on
set tabstop=2 " forces tabs to be X spaces
" End Tabs and formatting
" -----------------
" -----------------
" Custom formatting for specific filetypes:
" Makefiles
" So, since we need actual tab characters in make files, we probably
" shouldn't expand them into space characters, right?
autocmd FileType make set noexpandtab shiftwidth=2
" Oh, and let's keep textwidth for all text files to 78 chars
autocmd FileType text setlocal textwidth=80
" set vertical line denoting 80 character line length
"set colorcolumn=80
" setup vim so that python files automatically use PEP8-compliant indentation
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=80 fileformat=unix nosmartindent
"au BufNewFile,BufRead *.py
"\ set tabstop=4
"\ set softtabstop=4
"\ set shiftwidth=4
"\ set textwidth=79
"\ set expandtab
"\ set autoindent
"\ set fileformat=un
autocmd Filetype ruby setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 textwidth=80 fileformat=unix
" formatting for full stack development with javascript and node
autocmd Filetype javascript
\ setlocal expandtab |
\ setlocal softtabstop=2 |
\ setlocal shiftwidth=2
autocmd Filetype javascript.jsx
\ setlocal expandtab |
\ setlocal softtabstop=2 |
\ setlocal shiftwidth=2
"au BufNewFile,BufRead *.js,*.html,*.css
"\ set tabstop=2 |
"\ set expandtab |
"\ set softtabstop=2 |
"\ set shiftwidth=2
" Turn on JSX syntax highlighting for javascript files (*.js)
let g:jsx_ext_required = 0
" Set .js files as javascript.jsx
au BufReadPost,BufRead,BufNewFile *.js,*.jsx set syntax=javascript.jsx
" set .ts files as typescript
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
" Turn on support for Flow and syntax highlighting
"let g:javascript_plugin_flow = 1
" formatting for sql files (use spaces instead of tabs for example)
autocmd Filetype sql setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=79 fileformat=unix
" This should set .X68 files as 68k assembly files for syntax purposes
let filetype_X68 = "asm68k"
let filetype_pal = "pascal"
" Set .md files as Markdown syntax
au BufReadPost,BufRead,BufNewFile *.md set syntax=markdown
" End custom formatting for specific filetypes
" --------
" -----------------
" Keystrokes
" Alternate mappings to escape so it's easier to get out of insert mode
" currently just using <Esc> and <C-[>
" Map new keybind to Escape in insert mode
imap <A-i> <Esc>
" imap <A-.> <Esc>
"imap <S-space> <Esc>
imap jk <Esc>
imap kj <Esc>
" Remap semicolon (;) to function as colon (:), saving me from holding down
" Shift everytime I want to execute a command like save (:w)
:nmap ; :
" page down with <Space> and page up with -
" noremap <Space> <PageDown>
" noremap - <PageUp>
" Change <C-e> and <C-y> from scrolling down/up 1 line to 3 lines, so we don't
" have to keep hitting it over and over as much
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" Enable <TAB> for completion and navigation through popup menus
inoremap <expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" use <Tab> as trigger keys
" The below functionality might be broken as of 211204
"imap <Tab> <Plug>(completion_smart_tab)
"imap <S-Tab> <Plug>(completion_smart_s_tab)
" End Keystrokes
" -----------------
" in normal mode F2 will save the file
" nmap <F2> :w<CR>
" in insert mode F2 will exit insert, save, enters insert again
" imap <F2> <ESC>:w<CR>i
" -----------------
" NERDTree settings
" F3 now used for opening NERDTree and F8 for taglist
map <F3> :NERDTreeToggle<CR>
imap <F3> <C-o>:NERDTreeToggle<CR>
nmap <F8> :TagbarToggle<CR>
let NERDTreeMinimalUI=1
let NERDTreeDirArrows=1
let g:NERDTreeWinSize=30
" End NERDTree settings
" -----------------
" -----------------
" Highlight settings
" Turn off highlighting by double-tapping Escape
nnoremap <silent> <Esc><Esc> <Esc>:nohlsearch<CR><Esc>
" End Highlight settings
" -----------------
" -----------------
" Code folding
" see https://realpython.com/blog/python/vim-and-python-a-match-made-in-heaven/#.Vi9-CN7uzXY.reddit
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with spacebar
noremap <space> za
" End Code Folding settings
" -----------------
" -----------------
" python3 nvim pyenv environment
"if has('macunix')
if system('uname') =~ "Darwin"
let g:python3_host_prog=expand('/Users/jleung/.pyenv/versions/nvim-3.7.3/bin/python')
endif
"if has('unix')
if system('uname') =~ "Linux"
let g:python3_host_prog=expand('/home/jwl/.pyenv/versions/nvim-3.7.3/bin/python')
endif
" end python3 nvim pyenv environment
" -----------------
" -----------------
" Vim-Airline settings
" Enable displaying buffers at the top of the viewable area with airline
let g:airline#extensions#tabline#enabled = 1
" Show just the filename
"let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#formatter = 'short_path'
" Enable powerline symbols (ie. the little arrows)
let g:airline_powerline_fonts = 1
" End Vim-Airline settings
" -----------------
" -----------------
" Buffergator settings
"
" Use right side of screen
let g:buffergator_viewport_split_policy = 'R'
" I want my own keymappings
let g:buffergator_suppress_keymaps = 1
" for some reason, using BuffergatorMruCyclePrev and BuffergatorMruCycleNext
" leads to unusual behavior once more than a few (3?) tabs are open. Switching
" to :bnext and :bprev to see if that leads to more consistent behavior
" Go to previous buffer open
nmap <leader>jj :bprev<cr>
nmap <leader>hh :bprev<cr>
" Go to next buffer open
nmap <leader>kk :bnext<cr>
nmap <leader>ll :bnext<cr>
" View the entire list of buffers open
nmap <leader>bl :BuffergatorOpen<cr>
" <comma> then T for new tab
nmap <leader>T :enew<cr>
" Close the current buffer and move to the previous one. <comma> bq
nmap <leader>bq :bp <BAR> bd #<cr>
" End Buffergator settings
" -----------------
" ---------
" Begin ale settings
"let g:ale_linters = {
"\ 'javascript': ['prettier'],
"\ 'typescript': ['prettier'],
"\ 'css': ['prettier'],
"\}
"let g:ale_fixers = {
"\ 'javascript': ['prettier'],
"\ 'typescript': ['prettier'],
"\ 'css': ['prettier'],
"\}
" run Prettier on save
"let g:ale_fix_on_save = 1
" end ale settings
"---------
"---------
" Begin polyglot settings
" Since we're using semshi for python syntax highlighting, disable polyglot's python support so they don't conflict:
let g:polyglot_disabled = ['python']
" --------
" enable system clipboard for vim, allowing copy/paste to and from the system
" clipboard
" unnamed sets the * register, whereas unnamedplus sets to the + register. Presumably + is better? not entirely sure. See http://vim.wikia.com/wiki/Accessing_the_system_clipboard
"set clipboard=unnamedplus
set clipboard=unnamed
"---------
"---------
" Syntastic options
" Disable syntastic unless manually invoked for files that end in .html or
" .cpp
let g:syntastic_mode_map={ 'mode': 'active',
\ 'active_filetypes': ['python'],
\ 'passive_filetypes': ['html','c', 'cpp', 'h'] }
"------- end Syntastic options
"------- Emmet options
" make emmet use 'class' instead of 'classname' when editing *.jsx
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
" set emmet leader key to <Tab>
"let g:user_emmet_leader_key='<Tab>'
"------- end Emmet options
"------- Split window keybinds
nmap <leader>s :split<Return><C-w>w
nmap <leader>v :vsplit<Return><C-w>w
"------- end split window keybinds
" ------ Rust and Rust Analyzer config
" Set completeopt to have a better completion experience
" :help completeopt
" menuone: popup even when there's only one match
" noinsert: Do not insert text until a selection is made
" noselect: Do not select, force user to select one from the menu
set completeopt=menuone,noinsert,noselect
" Avoid showing extra messages when using completion
set shortmess+=c
" Configure LSP through rust-tools.nvim plugin.
" rust-tools will configure and enable certain LSP features for us.
" See https://github.com/simrat39/rust-tools.nvim#configuration
lua <<EOF
local nvim_lsp = require'lspconfig'
local opts = {
tools = { -- rust-tools options
autoSetHints = true,
inlay_hints = {
show_parameter_hints = false,
parameter_hints_prefix = "",
other_hints_prefix = "",
},
},
-- all the opts to send to nvim-lspconfig
-- these override the defaults set by rust-tools.nvim
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
server = {
-- on_attach is a callback called when the language server attachs to the buffer
-- on_attach = on_attach,
settings = {
-- to enable rust-analyzer settings visit:
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
["rust-analyzer"] = {
-- enable clippy on save
checkOnSave = {
command = "clippy"
},
}
}
},
}
require('rust-tools').setup(opts)
EOF
" Setup Completion
" See https://github.com/hrsh7th/nvim-cmp#basic-configuration
lua <<EOF
local cmp = require'cmp'
cmp.setup({
-- Enable LSP snippets
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
-- Add tab support
['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<Tab>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-w>'] = cmp.mapping.close(),
['<C-q>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
})
},
-- Installed sources
sources = {
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'buffer' },
},
})
-- Python LSP
require'lspconfig'.pyright.setup{}
EOF
" https://sharksforarms.dev/posts/neovim-rust/
" Code navigation shortcuts
nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <silent> gD <cmd>lua vim.lsp.buf.implementation()<CR>
nnoremap <silent> <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <silent> 1gD <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> ga <cmd>lua vim.lsp.buf.code_action()<CR>
" Set updatetime for CursorHold
" 300ms of no cursor movement to trigger CursorHold
set updatetime=300
" Show diagnostic popup on cursor hold
autocmd CursorHold * lua vim.diagnostic.open_float()
" Goto previous/next diagnostic warning/error
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
nnoremap <silent> g] <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
" have a fixed column for the diagnostics to appear in
" this removes the jitter when warnings/errors flow in
set signcolumn=yes
" Enable type inlay hints
" autocmd CursorMoved,InsertLeave,BufEnter,BufWinEnter,TabEnter,BufWritePost *
" \ lua require'lsp_extensions'.inlay_hints{ prefix = '', highlight = "Comment", enabled = {"TypeHint", "ChainingHint", "ParameterHint"} }
" ------ End Rust and Rust Analyzer config