diff --git a/.config/dconf/user b/.config/dconf/user index 36829bc..8b9cdfe 100644 Binary files a/.config/dconf/user and b/.config/dconf/user differ diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 3520d91..2aefffb 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -58,9 +58,6 @@ vim.keymap.set({ "n" }, "", "j") vim.keymap.set({ "n" }, "", "k") vim.keymap.set({ "n" }, "", "l") -vim.keymap.set('n', 'ld', vim.lsp.buf.definition, { desc = 'vim.lsp.buf.definition()' }) -vim.keymap.set('n', 'lf', vim.lsp.buf.format, { desc = 'vim.lsp.buf.format()' }) - -- [[ Basic Autocommands ]]. -- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()` -- Highlight when yanking (copying) text. @@ -129,6 +126,8 @@ end, { desc = "Print the git blame for the current line" }) -- 'updatetime' and when going to insert mode vim.cmd("packadd! nohlsearch") +-- [[ Language Setup ]] + -- Treat Ipe stylesheets as xml code vim.filetype.add({ extension = { @@ -138,14 +137,22 @@ vim.filetype.add({ -- Install nvim-treesitter vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" }) -require("nvim-treesitter").install('latex', 'lua', 'c', 'ocaml') +require("nvim-treesitter").install('lua', 'latex', 'c', 'java', 'ocaml') -- See `:h lsp-quickstart` for more details. vim.pack.add({ "https://github.com/mason-org/mason.nvim" }) require("mason").setup() -vim.lsp.enable({ 'lua_ls', 'texlab', 'clangd', 'ocaml-lsp' }) +vim.lsp.enable({'lua_ls', 'texlab', 'clangd', 'ocaml-lsp'}) +vim.keymap.set('n', 'lf', vim.lsp.buf.format, + { desc = 'Formats a buffer using the attached language server clients.' }) +vim.keymap.set('n', 'lh', vim.lsp.buf.hover, + { desc = 'Displays hover information about the symbol under the cursor.' }) +vim.keymap.set('n', 'lr', vim.lsp.buf.rename, + { desc = 'Renames all references to the symbol under the cursor.' }) +vim.keymap.set('n', 'ld', vim.lsp.buf.definition, + { desc = 'Jumps to the definition of the symbol under the cursor.' }) vim.diagnostic.config({ signs = { @@ -165,6 +172,74 @@ vim.keymap.set("n", "dN", "]D", { desc = "Jump to last diagnostic" }) vim.keymap.set("n", "dP", "[D", { desc = "Jump to first diagnostic" }) vim.keymap.set("n", "ds", "d", { desc = "Display diagnostic on current line" }) +vim.pack.add({ "https://github.com/mfussenegger/nvim-dap" }) + +local dap = require("dap") +local dap_widgets = require("dap.ui.widgets") +local dap_sidebar_s = dap_widgets.sidebar(dap_widgets.scopes) +local dap_sidebar_f = dap_widgets.sidebar(dap_widgets.frames) + +vim.keymap.set("n", "bb", dap.toggle_breakpoint, { desc = "Toggle breakpoint"}) +vim.keymap.set("n", "bc", dap.continue, { desc = "Continue execution"}) + +dap.listeners.on_session["debug"] = function() + vim.keymap.set("n", "bs", dap_sidebar_s.toggle, { desc = "Show scopes"}) + vim.keymap.set("n", "bf", dap_sidebar_f.toggle, { desc = "Show frames"}) + + vim.keymap.set("n", "", dap.step_out, { desc = "Step out"}) + vim.keymap.set("n", "", dap.step_into, { desc = "Step into"}) + vim.keymap.set("n", "", dap.step_over, { desc = "Step over"}) + vim.keymap.set("n", "", dap.restart_frame, { desc = "Restart frame"}) +end + +dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { "--interpreter=dap", "--eval-command", "set print pretty on" } +} + +dap.configurations.c = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + args = {}, -- provide arguments if needed + cwd = "${workspaceFolder}", + stopAtBeginningOfMainSubprogram = false, + }, + { + name = "Select and attach to process", + type = "gdb", + request = "attach", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + pid = function() + local name = vim.fn.input('Executable name (filter): ') + return require("dap.utils").pick_process({ filter = name }) + end, + cwd = '${workspaceFolder}' + }, + { + name = 'Attach to gdbserver :1234', + type = 'gdb', + request = 'attach', + target = 'localhost:1234', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}' + } +} + +dap.configurations.cpp = dap.configurations.c +dap.configurations.rust = dap.configurations.c + + + -- [[ UI Configuration ]] vim.pack.add({ "https://github.com/nvim-mini/mini.completion", @@ -176,7 +251,6 @@ vim.pack.add({ "https://github.com/nvim-mini/mini.clue", "https://github.com/nvim-mini/mini.hipatterns", "https://github.com/nvim-mini/mini.notify", - }, { confirm = false }) vim.o.winborder = "none" diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json index e0114c0..fcb5f0c 100644 --- a/.config/nvim/nvim-pack-lock.json +++ b/.config/nvim/nvim-pack-lock.json @@ -56,6 +56,14 @@ "rev": "caf23615b9b99bacc79ecd60f61c4e6a8ec18c84", "src": "https://github.com/nvim-mini/mini.tabline" }, + "nvim-dap": { + "rev": "cdfd55a133f63228c55f91378f12908cb2a78ded", + "src": "https://github.com/mfussenegger/nvim-dap" + }, + "nvim-dap-virtual-text": { + "rev": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6", + "src": "https://github.com/theHamsta/nvim-dap-virtual-text" + }, "nvim-lspconfig": { "rev": "92ee7d42320edfbb81f3cad851314ab197fa324a", "src": "https://github.com/neovim/nvim-lspconfig"