summaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-07-01 21:27:23 -0500
committerMarc Coquand <marc@mccd.space>2024-07-01 21:27:23 -0500
commit0c176f847c22c627c5b51d098d588dec49051cae (patch)
treea2d69dfdb66215baf05ba12631dde4444ed2a8cb /vimrc
parent0a20357d4585da91d92252972f3eb7b715ff64ab (diff)
downloadopenbsd-0c176f847c22c627c5b51d098d588dec49051cae.tar.gz
openbsd-0c176f847c22c627c5b51d098d588dec49051cae.tar.bz2
openbsd-0c176f847c22c627c5b51d098d588dec49051cae.zip
vimrc
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc166
1 files changed, 166 insertions, 0 deletions
diff --git a/vimrc b/vimrc
new file mode 100644
index 0000000..3a39621
--- /dev/null
+++ b/vimrc
@@ -0,0 +1,166 @@
+packadd snippets
+
+" Indentation
+set tabstop=8
+set shiftround
+set nobackup
+set autoindent
+set smartindent
+set cindent
+
+" Theme
+syntax on
+set background=light
+set rnu
+colorscheme quiet
+hi Normal ctermfg=black ctermbg=white
+"hi Keyword ctermfg=black cterm=bold
+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 = "\<Esc>[6 q"
+let &t_SR = "\<Esc>[4 q"
+let &t_EI = "\<Esc>[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<CR>
+
+" 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
+
+" Ocaml
+if exists('g:loaded_lsp')
+ call LspAddServer([#{
+ \ name: 'caml',
+ \ filetype: ['ocaml'],
+ \ path: 'ocamllsp',
+ \ args: [],
+ \ syncInit: v:true
+ \ }])
+end
+autocmd Filetype ocaml autocmd BufWritePre <buffer> :LspFormat
+
+" Go
+if exists('g:loaded_lsp')
+ call LspAddServer([#{
+ \ name: 'golang',
+ \ filetype: ['go', 'gomod'],
+ \ path: '/usr/bin/gopls',
+ \ args: ['serve'],
+ \ syncInit: v:true
+ \ }])
+end
+
+autocmd Filetype go set makeprg=go\ build
+autocmd Filetype go autocmd BufWritePre <buffer> :LspFormat
+
+" Nix
+if exists('g:loaded_lsp')
+ call LspAddServer([#{
+ \ name: 'nix',
+ \ filetype: ['nix'],
+ \ path: 'nixd',
+ \ args: [],
+ \ syncInit: v:true
+ \ }])
+end
+autocmd Filetype nix autocmd BufWritePre <buffer> :LspFormat
+
+" Markdown
+if exists('g:loaded_lsp')
+ call LspAddServer([#{
+ \ name: 'marksman',
+ \ filetype: ['markdown'],
+ \ path: 'marksman',
+ \ args: ['server'],
+ \ syncInit: v:true }])
+end
+
+
+" Keybindings
+let mapleader=" "
+noremap , :
+noremap <leader>e :e **/
+noremap <silent> gd mB:LspGotoDefinition<Enter>
+noremap <silent> gs mB:LspDocumentSymbol<Enter>
+noremap <silent> gr mB:LspGotoImpl<Enter>
+noremap <leader>ca :LspCodeAction<Enter>
+noremap <leader>cr :LspRename<Enter>
+noremap <leader>m :make<Enter>
+noremap <silent> <leader>k :LspDiagCurrent<Enter>
+noremap <silent> K :LspHover<Enter>
+nnoremap <leader>l :ls<CR>:b<space>
+nnoremap <silent> <leader>= :LspFormat<Enter>
+
+" 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
+