From 9053e1033e69f71389cc24196c6c588f8c35a683 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Mon, 1 Jul 2024 21:27:23 -0500 Subject: vimrc --- vimrc | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 vimrc (limited to 'vimrc') diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..0431ea6 --- /dev/null +++ b/vimrc @@ -0,0 +1,196 @@ +packadd snippets + +" General +set ignorecase + +" Indentation +set tabstop=8 +set shiftround +set nobackup +set autoindent +set smartindent +set cindent +set backspace=2 + +" Theme +syntax on +set background=light +set rnu +set termguicolors +colorscheme quiet +set incsearch +set matchpairs+=<:> +set t_Co=256 +hi Normal guifg=black guibg=#FEFFFA +"hi Keyword ctermfg=black cterm=bold +set tgc +hi SpellBad term=reverse cterm=underline ctermfg=124 ctermbg=white +hi SpellCap term=reverse cterm=underline ctermfg=25 ctermbg=white +hi SpellRare term=reverse cterm=underline ctermfg=30 ctermbg=white +hi SpellLocal term=reverse cterm=underline ctermfg=90 ctermbg=white + +" Cursor - switch between line and full +let &t_SI = "\[6 q" +let &t_SR = "\[4 q" +let &t_EI = "\[2 q" + +" Pesky swap +set backupdir=~/.vim/backup// +set directory=~/.vim/swap// +set undodir=~/.vim/undo// + +" Netrw +let g:netrw_keepdir = 0 +let g:netrw_banner = 0 +let g:netrw_localcopydircmd = 'cp -r' +hi! link netrwMarkFile Search +nnoremap - :Explore + +" LSP +packadd lsp + +if exists('g:loaded_lsp') + call LspOptionsSet(#{ + \ aleSupport: v:false, + \ autoComplete: v:false, + \ autoHighlight: v:false, + \ autoHighlightDiags: v:true, + \ autoPopulateDiags: v:true, + \ completionMatcher: 'case', + \ completionMatcherValue: 1, + \ diagSignErrorText: 'E', + \ diagSignHintText: 'H', + \ diagSignInfoText: 'I', + \ diagSignWarningText: 'W', + \ echoSignature: v:false, + \ hideDisabledCodeActions: v:false, + \ highlightDiagInline: v:true, + \ hoverInPreview: v:false, + \ ignoreMissingServer: v:true, + \ keepFocusInDiags: v:true, + \ keepFocusInReferences: v:true, + \ completionTextEdit: v:true, + \ diagVirtualTextAlign: 'above', + \ diagVirtualTextWrap: 'default', + \ noNewlineInCompletion: v:false, + \ omniComplete: v:null, + \ outlineOnRight: v:true, + \ outlineWinSize: 20, + \ semanticHighlight: v:false, + \ showDiagInBalloon: v:true, + \ showDiagInPopup: v:true, + \ showDiagOnStatusLine: v:false, + \ showDiagWithSign: v:false, + \ showDiagWithVirtualText: v:false, + \ showInlayHints: v:false, + \ showSignature: v:true, + \ snippetSupport: v:false, + \ ultisnipsSupport: v:false, + \ useBufferCompletion: v:false, + \ usePopupInCodeAction: v:false, + \ useQuickfixForLocations: v:false, + \ vsnipSupport: v:false, + \ bufferCompletionTimeout: 100, + \ customCompletionKinds: v:false, + \ completionKinds: {}, + \ filterCompletionDuplicates: v:false, + \ }) +end + +" Yaml +autocmd Filetype yaml setlocal tabstop=2 +autocmd Filetype yaml setlocal shiftwidth=2 +autocmd Filetype yaml setlocal expandtab +autocmd Filetype yaml setlocal smarttab + + +" Ocaml +if exists('g:loaded_lsp') + call LspAddServer([#{ + \ name: 'caml', + \ filetype: ['ocaml'], + \ path: 'ocamllsp', + \ args: [], + \ syncInit: v:true + \ }]) +end +autocmd Filetype ocaml autocmd BufWritePre :LspFormat +autocmd Filetype ocaml setlocal tabstop=2 +autocmd Filetype ocaml setlocal shiftwidth=2 +autocmd Filetype ocaml setlocal expandtab +autocmd Filetype ocaml setlocal smarttab + +" Go +if exists('g:loaded_lsp') + call LspAddServer([#{ + \ name: 'golang', + \ filetype: ['go', 'gomod', 'gowork', 'gohtml'], + \ path: 'gopls', + \ args: ['serve'], + \ syncInit: v:true + \ }]) +end + +autocmd Filetype go set makeprg=go\ build +"autocmd Filetype go autocmd BufWritePre :LspFormat + +au BufRead,BufNewFile *.tmpl set filetype=gohtml +autocmd Filetype gohtml setlocal tabstop=2 +" autocmd Filetype gohtml setlocal formatprg=djlint\ --profile=golang\ --reformat\ - + +" Nix +if exists('g:loaded_lsp') + call LspAddServer([#{ + \ name: 'nix', + \ filetype: ['nix'], + \ path: 'nixd', + \ args: [], + \ syncInit: v:true + \ }]) +end +"autocmd Filetype nix autocmd BufWritePre :LspFormat + +" Markdown +if exists('g:loaded_lsp') + call LspAddServer([#{ + \ name: 'marksman', + \ filetype: ['markdown'], + \ path: 'marksman', + \ args: ['server'], + \ syncInit: v:true }]) +end + + +autocmd Filetype markdown setlocal spell + + + +" Keybindings +let mapleader=" " +noremap , : +noremap e :e **/ +noremap gd mB:LspGotoDefinition +noremap ]d :LspDiagNext +noremap [d :LspDiagPrev +noremap gs mB:LspDocumentSymbol +noremap gr mB:LspGotoImpl +noremap ca :LspCodeAction +noremap cr :LspRename +noremap m :make +noremap k :LspDiagCurrent +noremap K :LspHover +nnoremap l :ls:b +nnoremap = :LspFormat + +" Spell +au BufEnter *.org set spell + +" Wildmenu +set wildmenu +set wildmode=longest:full,lastused +set wildignore=_build/**,release/**,node_modules/** +set wildoptions+=fuzzy + +" Grep +set grepprg=git\ grep\ -nH + -- cgit v1.2.3