-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
405 lines (366 loc) · 11.8 KB
/
config.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
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
--[[
lvim is the global options object
Linters should be
filled in as strings with either
a global executable or a path to
an executable
]]
-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
-- general
require("lvim.lsp.manager").setup "tailwindcss"
lvim.log.level = "warn"
lvim.format_on_save = true
lvim.colorscheme = "tokyonight-moon"
lvim.builtin.dap.active = true
lvim.builtin.project.active = true
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false
-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = "space"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-- unmap a default keymapping
-- vim.keymap.del("n", "<C-Up>")
-- override a default keymapping
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" -- or vim.keymap.set("n", "<C-q>", ":q<cr>" )
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
-- local _, actions = pcall(require, "telescope.actions")
-- lvim.builtin.telescope.defaults.mappings = {
-- -- for input mode
-- i = {
-- ["<C-j>"] = actions.move_selection_next,
-- ["<C-k>"] = actions.move_selection_previous,
-- ["<C-n>"] = actions.cycle_history_next,
-- ["<C-p>"] = actions.cycle_history_prev,
-- },
-- -- for normal mode
-- n = {
-- ["<C-j>"] = actions.move_selection_next,
-- ["<C-k>"] = actions.move_selection_previous,
-- },
-- }
-- Use which-key to add extra bindings with the leader-key prefix
lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
lvim.builtin.which_key.mappings["t"] = {
name = "+Trouble",
r = { "<cmd>Trouble lsp_references<cr>", "References" },
f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
l = { "<cmd>Trouble loclist<cr>", "LocationList" },
w = { "<cmd>Trouble workspace_diagnostics<cr>", "Wordspace Diagnostics" },
}
-- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.terminal.active = true
lvim.builtin.terminal.direction = "horizontal"
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.view.adaptive_size = true
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
lvim.builtin.nvimtree.setup.update_cwd = true
lvim.builtin.nvimtree.setup.update_focused_file.enable = true
lvim.builtin.nvimtree.setup.update_focused_file.update_cwd = true
lvim.builtin.nvimtree.setup.respect_buf_cwd = true
lvim.builtin.nvimtree.setup.disable_netrw = false
-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
"bash",
"c",
"javascript",
"json",
"lua",
"python",
"typescript",
"tsx",
"css",
"rust",
"java",
"yaml",
}
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enabled = true
-- generic LSP settings
-- ---@usage disable automatic installation of servers
-- lvim.lsp.automatic_servers_installation = false
-- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
-- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
-- require("lvim.lsp.manager").setup("pyright", opts)
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
-- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
-- vim.tbl_map(function(server)
-- return server ~= "emmet_ls"
-- end, lvim.lsp.automatic_configuration.skipped_servers)
-- -- you can set a custom on_attach function that will be used for all the language servers
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
-- lvim.lsp.on_attach_callback = function(client, bufnr)
-- local function buf_set_option(...)
-- vim.api.nvim_buf_set_option(bufnr, ...)
-- end
-- --Enable completion triggered by <c-x><c-o>
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- end
-- -- set a formatter, this will override the language server formatting capabilities (if it exists)
-- local formatters = require "lvim.lsp.null-ls.formatters"
-- formatters.setup {
-- { command = "black", filetypes = { "python" } },
-- { command = "isort", filetypes = { "python" } },
-- {
-- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
-- command = "prettier",
-- ---@usage arguments to pass to the formatter
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
-- extra_args = { "--print-with", "100" },
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
-- filetypes = { "typescript", "typescriptreact" },
-- },
-- }
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
{
command = "prettier",
filetypes = { "typescript", "typescriptreact", "astro" },
},
{ command = "goimports", filetypes = { "go" } },
{ command = "gofmt", filetypes = { "go" } },
{ command = "golines", filetypes = { "go" } },
}
local linters = require "lvim.lsp.null-ls.linters"
linters.setup {
{ command = "eslint", filetypes = { "typescript", "typescriptreact" } },
{ command = "staticcheck", filetypes = { "go" } },
-- { command = "golangci_lint", filetypes = { "go" } },
}
-- Additional Plugins
lvim.plugins = {
{ "nvim-neotest/neotest",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-go"
},
config = function()
-- get neotest namespace (api call creates or returns namespace)
local neotest_ns = vim.api.nvim_create_namespace("neotest")
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
local message =
diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
require("neotest").setup({
-- your neotest config here
adapters = {
require("neotest-go"),
},
})
end,
},
{ "sindrets/diffview.nvim" },
{
"junegunn/fzf.vim",
requires = {
"junegunn/fzf"
}
},
{
"folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim",
config = function()
require("todo-comments").setup {
-- Configuration options
-- ...
}
end
},
{ "voldikss/vim-floaterm" },
{ "vim-test/vim-test",
cmd = { "TestNearest", "TestFile", "TestSuite", "TestLast", "TestVisit" },
keys = { "<localleader>tf", "<localleader>tn", "<localleader>ts" },
config = function()
vim.cmd [[
function! ToggleTermStrategy(cmd) abort
call luaeval("require('toggleterm').exec(_A[1])", [a:cmd])
endfunction
let g:test#custom_strategies = {'toggleterm': function('ToggleTermStrategy')}
]]
end,
},
{ "mfussenegger/nvim-dap" },
{ "leoluz/nvim-dap-go",
config = function()
require("dap-go").setup()
end,
},
{ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } },
{ 'cappyzawa/starlark.vim' },
{ "folke/tokyonight.nvim" },
{ "tpope/vim-rhubarb" },
{
"tpope/vim-fugitive",
cmd = {
"G",
"Git",
"Gdiffsplit",
"Gread",
"Gwrite",
"Ggrep",
"GMove",
"GDelete",
"GBrowse",
"GRemove",
"GRename",
"Glgrep",
"Gedit"
},
ft = { "fugitive" }
},
{ "tpope/vim-surround" },
{ "dracula/vim" },
{ "fatih/vim-go" },
{ "ray-x/go.nvim" },
{
"folke/trouble.nvim",
cmd = "TroubleToggle",
},
{ "lukas-reineke/indent-blankline.nvim" },
{
"ahmedkhalf/lsp-rooter.nvim",
event = "BufRead",
config = function()
require("lsp-rooter").setup()
end,
},
{
"aca/emmet-ls",
config = function()
local lspconfig = require("lspconfig")
local configs = require("lspconfig/configs")
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
}
if not lspconfig.emmet_ls then
configs.emmet_ls = {
default_config = {
cmd = { "emmet-ls", "--stdio" },
filetypes = {
"html",
"css",
"javascript",
"typescript",
"eruby",
"typescriptreact",
"javascriptreact",
"svelte",
"vue",
},
root_dir = function(_)
return vim.loop.cwd()
end,
settings = {},
},
}
end
lspconfig.emmet_ls.setup({ capabilities = capabilities })
end,
},
{ 'brenoprata10/nvim-highlight-colors' },
{
"github/copilot.vim",
config = function()
-- copilot assume mapped
vim.g.copilot_assume_mapped = true
vim.g.copilot_no_tab_map = true
end,
},
{
"hrsh7th/cmp-copilot",
config = function()
lvim.builtin.cmp.formatting.source_names["copilot"] = "( )"
table.insert(lvim.builtin.cmp.sources, 2, { name = "copilot" })
end,
},
{ "ellisonleao/glow.nvim", config = function() require("glow").setup() end }
}
vim.opt.list = true
vim.opt.listchars:append "space:⋅"
vim.opt.listchars:append "eol:↴"
require("indent_blankline").setup {
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,
}
require('lspconfig').gopls.setup({
settings = {
gopls = {
gofumpt = true,
}
}
})
require('lspconfig').sorbet.setup({})
require('nvim-highlight-colors').setup {}
local dap = require('dap')
dap.adapters.ruby = function(callback, config)
callback {
type = "server",
host = "127.0.0.1",
port = "${port}",
executable = {
command = "bundle",
args = { "exec", "rdbg", "-n", "--open", "--port", "${port}",
"-c", "--", "bundle", "exec", config.command, config.script,
},
},
}
end
dap.configurations.ruby = {
{
type = "ruby",
name = "debug current file",
request = "attach",
localfs = true,
command = "ruby",
script = "${file}",
},
{
type = "ruby",
name = "run current spec file",
request = "attach",
localfs = true,
command = "rspec",
script = "${file}",
},
}
vim.g["test#strategy"] = "floaterm"
vim.g["test#neovim#term_position"] = "vert botright"
vim.g["test#go#runner"] = "richgo"
vim.g["test#neovim#start_normal"] = 1
lvim.builtin.which_key.mappings["t"] = {
name = "Test",
f = { "<cmd>TestFile<cr>", "File" },
n = { "<cmd>TestNearest<cr>", "Nearest" },
s = { "<cmd>TestSuite<cr>", "Suite" },
}
lvim.builtin.which_key.mappings["m"] = {
name = "+Terminal",
f = { "<cmd>ToggleTerm<cr>", "Floating terminal" },
v = { "<cmd>2ToggleTerm size=30 direction=vertical<cr>", "Split vertical" },
h = { "<cmd>2ToggleTerm size=30 direction=horizontal<cr>", "Split horizontal" },
}
vim.api.nvim_set_var("copilot_filetypes", {
["dap-repl"] = false,
})