This commit is contained in:
Tim Blume 2024-04-03 13:58:41 +02:00
parent 282dc5662d
commit eaeed514cf
8 changed files with 159 additions and 1 deletions

6
chadrc.lua Normal file
View file

@ -0,0 +1,6 @@
---@type ChadrcConfig
local M = {}
M.ui = { theme = 'catppuccin' }
M.plugins = "custom.plugins"
M.mappings = require("custom.mappings")
return M

13
configs/lspconfig.lua Normal file
View file

@ -0,0 +1,13 @@
local base = require("plugins.configs.lspconfig")
local on_attach = base.on_attach
local capabilities = base.capabilities
local lspconfig = require("lspconfig")
lspconfig.clangd.setup {
on_attach = function(client, bufnr)
client.server_capabilities.signatureHelpProvider = false
on_attach(client, bufnr)
end,
capabilities = capabilities,
}

25
configs/none-ls.lua Normal file
View file

@ -0,0 +1,25 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local none_ls = require("none-ls")
local opts = {
sources = {
none_ls.builtins.formatting.clang_format,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
}
return opts

View file

@ -43,6 +43,11 @@ M.capabilities.textDocument.completion.completionItem = {
},
}
require("lspconfig").gdscript.setup({
on_attach = M.on_attach,
capabilities = M.capabilities,
})
require("lspconfig").lua_ls.setup {
on_init = M.on_init,
on_attach = M.on_attach,

View file

@ -1,5 +1,5 @@
local options = {
ensure_installed = { "lua" },
ensure_installed = {"vim", "vimdoc", "c", "markdown", "gdscript", "godot_resource", "bash", "lua", "elixir", "heex", "eex" },
highlight = {
enable = true,

View file

@ -225,6 +225,35 @@ local default_plugins = {
end
end,
},
{
"elixir-tools/elixir-tools.nvim",
version = "*",
event = { "BufReadPre", "BufNewFile" },
config = function()
local elixir = require("elixir")
local elixirls = require("elixir.elixirls")
elixir.setup {
nextls = {enable = true},
credo = {},
elixirls = {
enable = true,
settings = elixirls.settings {
dialyzerEnabled = false,
enableTestLenses = false,
},
on_attach = function(client, bufnr)
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
end,
}
}
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
},
-- Only load whichkey after all the gui
{

17
mappings.lua Normal file
View file

@ -0,0 +1,17 @@
local M = {}
M.dap = {
plugin = true,
n = {
["<leader>db"] = {
"<cmd> DapToggleBreakpoint <CR>",
"Add breakpoint at line",
},
["<leader>dr"] = {
"<cmd> DapContinue <CR>",
"Start or continue the debugger",
}
}
}
return M

63
plugins.lua Normal file
View file

@ -0,0 +1,63 @@
local plugins = {
{
"rcarriga/nvim-dap-ui",
event = "VeryLazy",
dependencies = "mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
end
},
{
"jay-babu/mason-nvim-dap.nvim",
event = "VeryLazy",
dependencies = {
"williamboman/mason.nvim",
"mfussenegger/nvim-dap",
},
opts = {
handlers = {}
},
},
{
"mfussenegger/nvim-dap",
config = function(_, _)
require("core.utils").load_mappings("dap")
end
},
{
"nvimtools/none-ls.nvim",
event = "VeryLazy",
opts = function()
return require "custom.configs.none-ls"
end,
},
{
"neovim/nvim-lspconfig",
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end,
},
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"clangd",
"clang-format",
"codelldb",
}
}
}
}
return plugins