From 707b616009434d0506d5a84132c93544e312e507 Mon Sep 17 00:00:00 2001 From: Jannik Donker Date: Wed, 5 Nov 2025 14:07:20 +0100 Subject: [PATCH] added dapui and treesitter textobjects --- init.lua | 53 ++++++++++++++++++++++++++++++++++++--------- nvim-pack-lock.json | 12 ++++++++++ 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 273e721..3948565 100644 --- a/init.lua +++ b/init.lua @@ -17,7 +17,6 @@ vim.keymap.set("n", "k", "gk", { noremap = true, silent = true }) vim.keymap.set("v", "j", "gj", { noremap = true, silent = true }) vim.keymap.set("v", "k", "gk", { noremap = true, silent = true }) - -- VIM OPTIONS END -- -- PLUGINS START -- @@ -28,6 +27,7 @@ vim.pack.add({ { src = "https://github.com/echasnovski/mini.pick" }, { src = "https://github.com/neovim/nvim-lspconfig" }, { src = "https://github.com/nvim-treesitter/nvim-treesitter" }, + { src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" }, { src = "https://github.com/Saghen/blink.cmp", version = "v1.6.0", }, { src = "https://github.com/mason-org/mason.nvim" }, { src = "https://github.com/dimitry-ishenko-neovim/lualine-nvim" }, @@ -40,6 +40,8 @@ vim.pack.add({ { src = "https://github.com/nvim-tree/nvim-web-devicons" }, { src = "https://github.com/lewis6991/gitsigns.nvim" }, { src = "https://github.com/folke/trouble.nvim" }, + { src = "https://github.com/rcarriga/nvim-dap-ui", dependencies = { "https://github.com/mfussenegger/nvim-dap", "https://github.com/nvim-neotest/nvim-nio" } }, + { src = "https://github.com/nvim-neotest/nvim-nio" }, }) vim.cmd("colorscheme gruvbox") @@ -53,6 +55,20 @@ require("nvim-treesitter.configs").setup({ auto_install = true, highlight = { enable = true }, indent = { enable = true }, + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + }, }) require("mason").setup() require("lualine").setup { @@ -67,6 +83,25 @@ require("trouble").setup() -- PLUGINS END -- +-- DAP START -- + +require("dapui").setup() +local dap, dapui = require("dap"), require("dapui") +dap.listeners.before.attach.dapui_config = function() + dapui.open() +end +dap.listeners.before.launch.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 + +-- DAP END -- + -- LSP START -- vim.lsp.enable({ "lua_ls", "ts_ls", "svelte", "tailwindcss", "cssls", "bashls", "rust_analyzer", "clangd", "clang-format", @@ -81,14 +116,6 @@ vim.lsp.config["tinymist"] = { }, } -vim.lsp.config("jdtls", { - root_dir = vim.fn.getcwd(), - settings = { - java = { - }, - }, -}) - vim.api.nvim_create_autocmd('FileType', { pattern = 'java', callback = function(args) @@ -193,13 +220,19 @@ map.set("n", "ca", vim.lsp.buf.code_action, { desc = "Code Action" }) map.set("n", "rn", vim.lsp.buf.rename, { desc = "Rename symbol" }) map.set("n", "xx", "Trouble diagnostics toggle focus=true", { desc = "Diagnostics (Trouble)" }) -map.set("n", "xX", "Trouble diagnostics toggle filter.buf=0 focus=true", { desc = "Buffer Diagnostics (Trouble)" }) +map.set("n", "xX", "Trouble diagnostics toggle filter.buf=0 focus=true", + { desc = "Buffer Diagnostics (Trouble)" }) map.set("n", "", ":Pick files") map.set("n", "", ":Pick grep_live") map.set("n", "", ":Pick help") map.set("n", "", ":Oil") +map.set("n", "duo", dapui.open) +map.set("n", "duc", dapui.close) +map.set("n", "dbp", dap.toggle_breakpoint) +map.set("n", "drc", dap.run_to_cursor) + -- Move to previous/next map.set('n', '', 'BufferPrevious', opts) map.set('n', '', 'BufferNext', opts) diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index bbdbbff..e1d8eeb 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -20,10 +20,22 @@ "mason.nvim": [], "mini.pick": [], "nvim-dap": [], + "nvim-dap-ui": { + "rev": "cf91d5e", + "src": "https://github.com/rcarriga/nvim-dap-ui" + }, "nvim-jdtls": [], "nvim-lightbulb": [], "nvim-lspconfig": [], + "nvim-nio": { + "rev": "21f5324", + "src": "https://github.com/nvim-neotest/nvim-nio" + }, "nvim-treesitter": [], + "nvim-treesitter-textobjects": { + "rev": "5ca4aaa", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" + }, "nvim-web-devicons": { "rev": "8dcb311", "src": "https://github.com/nvim-tree/nvim-web-devicons"