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
|
packadd snippets
" General
set ignorecase
" Indentation
set tabstop=8
set shiftround
set nobackup
set autoindent
set smartindent
set cindent
" Theme
syntax on
set background=light
set rnu
colorscheme quiet
set incsearch
set matchpairs+=<:>
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
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: '/usr/bin/gopls',
\ args: ['serve'],
\ syncInit: v:true
\ }])
end
autocmd Filetype go set makeprg=go\ build
autocmd Filetype go autocmd BufWritePre <buffer> :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 <buffer> :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 <leader>e :e **/
noremap <silent> gd mB:LspGotoDefinition<Enter>
noremap <silent> ]d :LspDiagNext<Enter>
noremap <silent> [d :LspDiagPrev<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
|