-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
309 lines (241 loc) · 8.27 KB
/
init.lua
File metadata and controls
309 lines (241 loc) · 8.27 KB
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
vim.cmd([[
" Config vim-plug
call plug#begin('~/.local/share/nvim/site/autoload')
" Neovim 0.5+ stuff, clean up later
" Plug 'nvim-treesitter/nvim-treesitter', {'tag': '0.9.1', 'do': ':TSUpdate'}
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-treesitter/playground'
" LSP
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'
" Plug 'cuducos/yaml.nvim'
" auto-complete
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/vim-vsnip-integ'
" dependencies
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
" telescope
Plug 'nvim-telescope/telescope.nvim'
" typescript
Plug 'mhartington/formatter.nvim'
"end Neovim 0.5 stuff
" status bar line
" Plug 'vim-airline/vim-airline'
" Plug 'vim-airline/vim-airline-themes'
" Plug 'glepnir/galaxyline.nvim' , {'branch': 'main'}
Plug 'nvim-lualine/lualine.nvim'
" indent lines plugin
Plug 'lukas-reineke/indent-blankline.nvim'
" nvim tree
Plug 'nvim-tree/nvim-tree.lua'
Plug 'scrooloose/nerdtree'
Plug 'gregsexton/matchtag'
" .editorconfig plugin
" Plug 'editorconfig/editorconfig-vim'
" indent plugin
Plug 'windwp/nvim-autopairs'
" autotags plugin
Plug 'windwp/nvim-ts-autotag'
" match tags plugin
Plug 'andymass/vim-matchup'
" themes
" Plug 'rakr/vim-one'
" Plug 'tomasiser/vim-code-dark'
" Plug 'joshdick/onedark.vim'
Plug 'folke/tokyonight.nvim'
Plug 'marko-cerovac/material.nvim'
Plug 'tjdevries/colorbuddy.nvim'
Plug 'Th3Whit3Wolf/onebuddy'
Plug 'navarasu/onedark.nvim'
" dev icons
Plug 'nvim-tree/nvim-web-devicons'
" Initialize plugins
call plug#end()
let g:NERDTreeStatusline = -1
]])
-- nvim tree config
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- NERDTree config
-- shortcuts to telescope commands
vim.keymap.set('n', 'ff', [[<cmd>Telescope find_files<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', 'fg', [[<cmd>Telescope live_grep<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', 'fb', [[<cmd>Telescope buffers<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', 'fh', [[<cmd>Telescope help_tags<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', 'fr', [[<cmd>Telescope resume<CR>]], { noremap = true, silent = true })
-- compe config
-- vim.keymap.set('i', '<C-Space>', [[compe#complete()]], { noremap = true, silent = true, expr = true })
-- vim.keymap.set('i', '<C-e>', [[compe#close(\'<C-e>\')]], { noremap = true, silent = true, expr = true })
-- vim.keymap.set('i', '<C-f>', [[compe#scroll(\'delta\': +4)]], { noremap = true, silent = true, expr = true })
-- vim.keymap.set('i', '<C-d>', [[compe#scroll(\'delta\': -4)]], { noremap = true, silent = true, expr = true })
-- format, go-to definition, hover over description / errors
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { noremap = true, silent = true })
vim.keymap.set('n', 'D', vim.lsp.buf.hover, { noremap = true, silent = true })
vim.keymap.set('n', 'F', [[<cmd>:Format<CR>]], { noremap = true, silent = true })
-- I don't think you need these anymore
-- syntax on
-- filetype indent plugin on
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
vim.api.nvim_create_autocmd('FileType', {
pattern = {'*.h', '*.c', '*.cpp'},
callback = function(ev)
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
vim.opt_local.softtabstop = 4
vim.opt_local.expandtab = true
end
})
-- add templ language
vim.filetype.add({ extension = {templ = "templ"} })
vim.cmd([[
" shortcuts to show various Telescope screens
" nnoremap <silent>ff <cmd>Telescope find_files<CR>
" nnoremap <silent>fg <cmd>Telescope live_grep<CR>
" nnoremap <silent>fb <cmd>Telescope buffers<CR>
" nnoremap <silent>fh <cmd>Telescope help_tags<CR>
" nnoremap <silent>fr <cmd>Telescope resume<CR>
" compe config
"" let g:lexima_no_default_rules = v:true
"" call lexima#set_default_rules()
" inoremap <silent><expr> <C-Space> compe#complete()
"" inoremap <silent><expr> <CR> compe#confirm(lexima#expand('<LT>CR>', 'i'))
" inoremap <silent><expr> <C-e> compe#close('<C-e>')
" inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
" inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
" nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
" nnoremap <silent> D <cmd>lua vim.lsp.buf.hover()<CR>
" nnoremap <silent> F <cmd>:Format<CR>
" tabs
" set tabstop=4
" set shiftwidth=4
" set softtabstop=4
" set expandtab
" C, C++
" au FileType c,cpp,h set tabstop=4
" au FileType c,cpp,h set shiftwidth=4
" au FileType c,cpp,h set softtabstop=4
" au FileType c,cpp,h set expandtab
" Go
au FileType go set tabstop=4
au FileType go set shiftwidth=4
au FileType go set softtabstop=4
au FileType go set expandtab
au FileType go nnoremap <silent> F <cmd> lua vim.lsp.buf.format {async = true}<CR>
" Templ
" au FileType templ nnoremap <silent> F <cmd> lua vim.lsp.buf.format {async = true}<CR>
" Javascript / html / css
au FileType js,javascript,vue,ts,html,css,typescript,typescriptreact set tabstop=4
au FileType js,javascript,vue,ts,html,css,typescript,typescriptreact set shiftwidth=4
au FileType js,javascript,vue,ts,html,css,typescript,typescriptreact set softtabstop=4
au FileType js,javascript,vue,ts,html,css,typescript,typescriptreact set expandtab
" JS abbreviations
" console.log()
au FileType js,javascript,javascriptreact,vue,ts,typescript,typescriptreact
\ :iabbrev <buffer> ccc console.log("")<Left><Left><C-R>=Eatchar('\s')<CR>
" console.trace()
au FileType js,javascript,javascriptreact,vue,ts,typescript,typescriptreact
\ :iabbrev <buffer> cct console.trace()<C-R>=Eatchar('\s')<CR>
" useEffect shortcut for react
au FileType js,javascript,javascriptreact,vue,ts,typescript,typescriptreact
\ :iabbrev <buffer> uuee useEffect(() => {}, [])<Left><Left><C-R>=Eatchar('\s')<CR>
" PHP
au FileType php set tabstop=4
au FileType php set shiftwidth=4
au FileType php set softtabstop=4
au FileType php set expandtab
" Lua
au FileType lua set tabstop=2
au FileType lua set shiftwidth=2
au FileType lua set softtabstop=2
au FileType lua set expandtab
" yaml
au FileType yml,yaml set tabstop=2
au FileType yml,yaml set shiftwidth=2
au FileType yml,yaml set softtabstop=2
au FileType yml,yaml set expandtab
" Fix autoindent for YAML - DO NOT indent a line when commenting a line
autocmd BufNewFile,BufReadPost *.yaml :set indentkeys-=0#
" JSON
au FileType json set tabstop=4
au FileType json set shiftwidth=4
au FileType json set softtabstop=4
au FileType json set expandtab
" misc
set number relativenumber
set nu rnu
set showmatch
set wildmenu
set laststatus=2
" colors
set t_Co=256
set t_ut=
" colorscheme onedark
" let g:airline_theme='deus'
" highlight line
" hi CursorLineNr guifg=#333333
" set cursorline
" set cursorlineopt=number
" my mappings
" nmap <C-P> :FZF<CR>
" fix first one
nmap zj zt 10<C-y>
nmap <F2> :NERDTree<CR>
" nmap <F2> :NvimTreeToggle<CR>
" make nerdree add node menu one line
" there's a bug where it won't collapse
let g:NERDTreeMinimalMenu=1
" shortcut for jumping 4 spaces up or down
nmap J 4j
nmap K 4k
" show cutoff errors in it's own window
nnoremap <silent> sh <cmd>lua vim.diagnostic.open_float({scope="line"})<CR>
" I forget what this does
autocmd BufNewFile,BufRead * setlocal formatoptions-=cro
" Functions
func Eatchar(pat)
let c = nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunc
]])
-- Order matters (or does it?)
-- vim.g.material_style = "darker"
-- temp fix for treesitter highlighting
-- require('_treefix')
require('_nvimtree')
require('_util')
-- require('galaxyline/_space')
require('_treesitter')
require('_telescope')
require('_compe-config')
require('_lualine')
-- LSP
require('_lsp-mason') -- must come first!
require('_lsp-golang')
require('_lsp-templ')
require('_lsp-tsserver')
require('_lsp-html-css')
require('_lsp-htmx')
require('_lsp-tailwind')
require('_lsp-cpp')
require('_lsp-php')
-- require('_lsp-yaml')
-- Look and feel
require('_colors')
require('_dev-icons')
vim.cmd.colorscheme("onedark")
vim.cmd([[
highlight DiagnosticError ctermfg=1 guibg=#403037 guifg=#e06c75
highlight DiagnosticUnderlineError cterm=underline gui=underline guisp=#713f47
highlight MatchWord ctermfg=yellow guifg=#60D5EF guibg=#2A3942 cterm=underline gui=underline
highlight MatchParen ctermfg=yellow guifg=#F5945C guibg=#343032
]])