-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
270 lines (233 loc) · 7.67 KB
/
init.lua
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
require('user.settings') -- general non plugin related settings
require('user.config') -- general configuration stuff
require('user.plugins.statusline') -- custom statusline
require('user.plugins.tabline') -- custom tabline
require('user.plugins.clever-f') -- "clever-f" like functionality
require('user.plugins.rooter') -- set cwd to "project" root automatically
require('user.plugins.journal') -- simple journal functionality
-- local user configuration (if present)
if not pcall(require, 'user.local') then
vim.api.nvim_echo({ 'No system local configuration found! Check "lua/user/local.lua.sample" for more information...' }, true, { err = true })
end
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- lazy.nvim config & utilities
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- automatically bootstrap alpacka.nvim
local alpacka_path = vim.fn.stdpath('data') .. '/site/pack/alpacka/opt/alpacka.nvim'
if not vim.uv.fs_stat(alpacka_path) then
local out = vim.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/theblob42/alpacka.nvim.git',
alpacka_path,
}):wait()
if out.code ~= 0 then
print('Error when cloning "alpacka.nvim":\n' .. out.stderr)
end
end
vim.cmd.packadd('alpacka.nvim')
---Utility function which just returns a function requiring the specific plugin module
---@param module string The configuration module to require (must reside in the "plugin" folder)
---@return function config-fn A proper configuration function being used with lazy.nvim package manager
local function plugin_config(module)
return function()
require('plugins.' .. module)
end
end
require('alpacka').setup {
'theblob42/alpacka.nvim',
'tpope/vim-surround', -- easy "surroundings"
'tpope/vim-repeat', -- repeat plug mappings with '.'
'tpope/vim-sleuth', -- auto configure `shiftwidth`
'kyazdani42/nvim-web-devicons', -- provide icons and colors
'nvim-lua/plenary.nvim', -- dependency for gitlinker
{
-- sneak like motion plugin
'ggandor/leap.nvim',
config = plugin_config('leap'),
},
{
-- two char escape sequence
'TheBlob42/houdini.nvim',
config = function()
require('houdini').setup {
mappings = { 'fd' }
}
end,
},
{
-- fancy notifications
'rcarriga/nvim-notify',
config = plugin_config('notify'),
},
{
-- display possible key bindings in a popup
'folke/which-key.nvim',
config = plugin_config('which-key'),
},
{
-- interactive code evaluation
'theblob42/simple-repl.nvim',
},
{
load = function()
return vim.fn.executable('cargo') == 1
end,
'eraserhd/parinfer-rust',
build = function()
vim.system({ 'cargo', 'build', '--release' }):wait()
end,
},
-- TREESITTER
{
'nvim-treesitter/nvim-treesitter',
build = function()
require('nvim-treesitter.install').update({ with_sync = true })()
end,
config = plugin_config('treesitter'),
},
-- COLORSCHEME
{
'miikanissi/modus-themes.nvim',
config = plugin_config('modus'),
},
-- GIT
{
-- git information integration
'lewis6991/gitsigns.nvim',
config = plugin_config('gitsigns'),
},
{
-- create shareable file permalinks
'ruifm/gitlinker.nvim',
config = plugin_config('gitlinker'),
init = function()
vim.keymap.set('n', '<leader>gy', function()
require('gitlinker').get_buf_range_url('n')
end, { desc = 'copy git permalink' })
vim.keymap.set('v', '<leader>gy', function()
require('gitlinker').get_buf_range_url('v')
end, { desc = 'copy git permalink' })
end,
},
-- LSP
{
-- install external dependencies (LSP servers, DAP servers, etc.)
'williamboman/mason.nvim',
build = function()
require('mason-registry').refresh()
end
},
'williamboman/mason-lspconfig.nvim', -- make integration of mason.nvim and lspconfig easier
{
-- special configuration for Lua (NVIM development)
'folke/lazydev.nvim',
config = function()
---@diagnostic disable-next-line: missing-fields
require('lazydev').setup {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
{ path = 'snacks.nvim', words = { 'Snacks' } },
},
}
end
},
'mfussenegger/nvim-jdtls', -- special LSP configuration for Java
'neovim/nvim-lspconfig', -- "general" LSP configuration
{
-- show lsp progress
'j-hui/fidget.nvim',
config = function()
require('fidget').setup {
progress = {
display = {
render_limit = 6
}
}
}
end,
},
-- DAP
'mfussenegger/nvim-dap', -- debug configuration (DAP)
'rcarriga/nvim-dap-ui', -- an "out-of-the-box" UI for dap
-- SNIPPETS
{
'L3MON4D3/LuaSnip',
config = plugin_config('luasnip'),
},
-- AUTO COMPLETION
{
'hrsh7th/nvim-cmp',
config = plugin_config('cmp'),
},
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'saadparwaiz1/cmp_luasnip',
{
-- insert parentheses, brackets & quotes in pairs
'windwp/nvim-autopairs',
config = plugin_config('autopairs'),
},
{
'folke/snacks.nvim',
config = plugin_config('snacks'),
},
{
-- separate "cut" from "delete"
'TheBlob42/vim-cutlass',
config = function()
vim.g.CutlassRecursiveSelectBindings = 1 -- make it work with "autopairs"
vim.keymap.set('x', 'x', 'd') -- "cut operation" for visual mode
end,
},
{
-- edit files with sudo privileges
'lambdalisue/suda.vim',
config = function()
vim.keymap.set('n', '<leader>fer', '<CMD>SudaRead<CR>', { desc = 'sudo read' })
vim.keymap.set('n', '<leader>few', '<CMD>SudaWrite<CR>', { desc = 'sudo write' })
end,
},
{
-- preview markdown in your browser
'iamcco/markdown-preview.nvim',
build = function()
vim.fn['mkdp#util#install']()
end,
},
{
'stevearc/oil.nvim',
config = function()
local oil = require('oil')
oil.setup {
columns = {
'size',
'icon',
},
view_options = {
show_hidden = true,
},
keymaps = {
['<C-y>'] = { 'actions.yank_entry', mode = 'n' }
}
}
vim.keymap.set('n', '-', oil.open, { desc = 'Open parent directory' })
vim.keymap.set('n', '_', function()
oil.open(vim.loop.cwd())
end, { desc = 'Open current working directory' })
end,
},
'modille/groovy.vim', -- handle groovy indent correctly
"kongo2002/fsharp-vim", -- since there is no default syntax highlighting
'AndrewRadev/linediff.vim', -- perform diffs only on parts of a buffer
}
-- load all custom user commands from "lua/user/commands"
for name, _ in vim.fs.dir(vim.fn.fnamemodify(vim.env.MYVIMRC, ':h') .. '/lua/user/commands') do
local cmd = string.match(name, '(.*)%.lua')
require('user.commands.'..cmd)
end
require('user.keymaps')
require('lsp')