packadd snippets " General set ignorecase set backspace=indent,eol,start set nocompatible filetype plugin on " Indentation set tabstop=8 set shiftround set nobackup set autoindent set smartindent set nu " Search set incsearch set matchpairs+=<:> " Theme syntax on set title set background=light set termguicolors colorscheme quiet set t_Co=256 set tgc hi Normal guifg=black guibg=#FFFFFF "hi String guifg=blue hi Comment guifg=blue cterm=italic hi Directory cterm=bold hi SpellBad term=reverse term=underline guibg=#FFFFFF hi SpellCap term=reverse term=underline guibg=#FFFFFF hi SpellRare term=reverse term=underline guibg=#FFFFFF hi SpellLocal term=reverse term=underline guibg=#FFFFFF "" Cursor - switch between line and full when going to insert mode 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:true, \ 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 " 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 " Go if exists('g:loaded_lsp') call LspAddServer([#{ \ name: 'golang', \ filetype: ['go', 'gomod', 'gowork', 'gohtml'], \ path: 'gopls', \ args: ['serve'], \ syncInit: v:true \ }]) end filetype plugin on autocmd Filetype go set makeprg=go\ build "autocmd Filetype go autocmd BufWritePre :LspFormat " Auto test directory with t autocmd Filetype go nnoremap t :!go test %:h/*.go au BufRead,BufNewFile *.tmpl set filetype=gohtml autocmd Filetype gohtml setlocal tabstop=2 " dot autocmd Filetype dot set makeprg=dot\ -Tjpg\ system-setup.dot\ >\ /tmp/dotout.jpg\ &&\ imv\ /tmp/dotout.jpg " 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 , : nnoremap é noremap e :e! **/* noremap gd :LspGotoDefinition noremap ]d :LspDiagNext noremap [d :LspDiagPrev noremap ]c :cnext noremap [c :cprev noremap gs :LspDocumentSymbol noremap gr :LspGotoImpl noremap ca :LspCodeAction noremap cr :LspRename noremap m :make noremap k :LspDiagCurrent noremap K :LspHover " Allow mapping tab set wildcharm= nmap b :b nnoremap = :LspFormat "" Tab completion inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" " Spell au BufEnter *.org set spell " Wildmenu set wildmenu set wildignore=_build/**,release/**,node_modules/** set wildoptions=fuzzy " Grep set grepprg=git\ grep\ -nH " Auto add marks augroup VIMRC autocmd! autocmd BufLeave *.css,*.scss normal! mC autocmd BufLeave *.html normal! mH autocmd BufLeave *.js,*.ts normal! mJ autocmd BufLeave *.md normal! mM autocmd BufLeave *.yml,*.yaml normal! mY autocmd BufLeave *_test.go normal! mT autocmd BufLeave *{_test}\@ [ let @b = 'di(a[]P%2X' "" Change [ -> ( let @k = 'di["_c%()P'