diff --git a/chadrc.lua b/chadrc.lua new file mode 100644 index 0000000..a37eac5 --- /dev/null +++ b/chadrc.lua @@ -0,0 +1,6 @@ +---@type ChadrcConfig + local M = {} + M.ui = { theme = 'catppuccin' } + M.plugins = "custom.plugins" + M.mappings = require("custom.mappings") + return M diff --git a/configs/lspconfig.lua b/configs/lspconfig.lua new file mode 100644 index 0000000..d798184 --- /dev/null +++ b/configs/lspconfig.lua @@ -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, +} diff --git a/configs/none-ls.lua b/configs/none-ls.lua new file mode 100644 index 0000000..0d14700 --- /dev/null +++ b/configs/none-ls.lua @@ -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 diff --git a/lua/plugins/configs/lspconfig.lua b/lua/plugins/configs/lspconfig.lua index 4124633..1e3f881 100644 --- a/lua/plugins/configs/lspconfig.lua +++ b/lua/plugins/configs/lspconfig.lua @@ -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, diff --git a/lua/plugins/configs/treesitter.lua b/lua/plugins/configs/treesitter.lua index b21b55d..f6a6984 100644 --- a/lua/plugins/configs/treesitter.lua +++ b/lua/plugins/configs/treesitter.lua @@ -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, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c124819..a8829f2 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -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", "fp", ":ElixirFromPipe", { buffer = true, noremap = true }) + vim.keymap.set("n", "tp", ":ElixirToPipe", { buffer = true, noremap = true }) + vim.keymap.set("v", "em", ":ElixirExpandMacro", { buffer = true, noremap = true }) + end, + } + } + end, + dependencies = { + "nvim-lua/plenary.nvim", + }, + }, -- Only load whichkey after all the gui { diff --git a/mappings.lua b/mappings.lua new file mode 100644 index 0000000..3b7be8e --- /dev/null +++ b/mappings.lua @@ -0,0 +1,17 @@ +local M = {} + +M.dap = { + plugin = true, + n = { + ["db"] = { + " DapToggleBreakpoint ", + "Add breakpoint at line", + }, + ["dr"] = { + " DapContinue ", + "Start or continue the debugger", + } + } +} + +return M diff --git a/plugins.lua b/plugins.lua new file mode 100644 index 0000000..4e62669 --- /dev/null +++ b/plugins.lua @@ -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