commit bbb3a9dfd32d978c13c27f0fc9ec2b660eb66ddb Author: DarianTr Date: Thu Sep 28 13:46:55 2023 +0200 initial commit 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..7d5474a --- /dev/null +++ b/configs/lspconfig.lua @@ -0,0 +1,11 @@ +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, +} diff --git a/configs/null-ls.lua b/configs/null-ls.lua new file mode 100644 index 0000000..5805765 --- /dev/null +++ b/configs/null-ls.lua @@ -0,0 +1,25 @@ +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) +local null_ls = require("null-ls") + +local opts = { + sources = { + null_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/mappings.lua b/mappings.lua new file mode 100644 index 0000000..3764846 --- /dev/null +++ b/mappings.lua @@ -0,0 +1,29 @@ +local M = {} + +M.dap = { + plugin = true, + n = { + ["db"] = { + " DapToggleBreakpoint ", + "Add breakpoint at line", + }, + ["dr"] = { + " DapContinue ", + "Start or continue the debugger", + }, + ["pf"] = { + "Telescope find_files", + "Open Telescope", + }, + ["lc"] = { + " VimtexComile ", + "Start latex compiler and preview", + }, + ["ls"] = { + " VimtexStop ", + "Stop latex compiler", + }, + } +} + +return M diff --git a/plugins.lua b/plugins.lua new file mode 100644 index 0000000..aa6d83f --- /dev/null +++ b/plugins.lua @@ -0,0 +1,85 @@ +local plugins = { + { + 'KDE/okular' + }, + { + 'lervag/vimtex', + opt = true, + config = function () + vim.g.vimtex_view_general_viewer = 'okular' + --vim.g.vimtex_compiler_latexmk_engines = { + -- _ = 'latexmk' + --} + vim.g.tex_comment_nospell = 1 + --vim.g.vimtex_compiler_progname = 'nvr' + vim.g.vimtex_view_general_options = [[--unique file:@pdf\#src:@line@tex]] + --vim.g.vimtex_compiler_method = 'latexmk' + --vim.g.vimtex_view_general_options_latexmk = '--unique' + end, + ft = 'tex' + }, + { + "simrat39/rust-tools.nvim", + }, + { + "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 + }, + { + "jose-elias-alvarez/null-ls.nvim", + event = "VeryLazy", + opts = function() + return require "custom.configs.null-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