diff options
-rw-r--r-- | nvim/.config/nvim/lua/plugins/dap.lua | 13 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/treesitter.lua | 4 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/tobyvin/utils.lua | 29 |
3 files changed, 38 insertions, 8 deletions
diff --git a/nvim/.config/nvim/lua/plugins/dap.lua b/nvim/.config/nvim/lua/plugins/dap.lua index ec3bddb..e5409ef 100644 --- a/nvim/.config/nvim/lua/plugins/dap.lua +++ b/nvim/.config/nvim/lua/plugins/dap.lua @@ -10,7 +10,7 @@ local M = { }, keys = { "<leader>db", - "<leader>dc", + "<leader>dl", "<F5>", }, dependencies = { @@ -18,11 +18,6 @@ local M = { "leoluz/nvim-dap-go", "nvim-telescope/telescope-dap.nvim", { - "LiadOz/nvim-dap-repl-highlights", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - config = true, - }, - { "theHamsta/nvim-dap-virtual-text", dependencies = { "nvim-treesitter/nvim-treesitter" }, opts = { @@ -35,11 +30,13 @@ local M = { function M:config() require("dap").listeners.after.event_initialized["User"] = function() vim.api.nvim_exec_autocmds("User", { pattern = "DapAttach" }) + vim.notify("DAP attached", vim.log.levels.INFO) end require("dap").listeners.before.event_terminated["User"] = function() vim.api.nvim_exec_autocmds("User", { pattern = "DapDetach" }) require("dap").repl.close() + vim.notify("DAP detached", vim.log.levels.INFO) end local adapters = require("tobyvin.dap.adapters") @@ -58,9 +55,9 @@ function M:config() vim.fn.sign_define("DapBreakpoint", { text = " ", texthl = "debugBreakpoint" }) vim.fn.sign_define("DapBreakpointCondition", { text = " ", texthl = "debugBreakpoint" }) - vim.fn.sign_define("DapBreakpointRejected", { text = " ", texthl = "debugBreakpoint" }) + vim.fn.sign_define("DapBreakpointRejected", { text = " ", texthl = "debugBreakpoint", numhl = "Error" }) vim.fn.sign_define("DapLogPoint", { text = " ", texthl = "debugBreakpoint" }) - vim.fn.sign_define("DapStopped", { text = " ", texthl = "debugBreakpoint" }) + vim.fn.sign_define("DapStopped", { text = " ", texthl = "debugBreakpoint", linehl = "CursorLine" }) vim.keymap.set("n", "<F5>", require("dap").continue, { desc = "continue" }) vim.keymap.set("n", "<F10>", require("dap").step_over, { desc = "step over" }) diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 841a808..21bdcad 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -7,6 +7,10 @@ local M = { "nvim-treesitter/nvim-treesitter-textobjects", "mfussenegger/nvim-ts-hint-textobject", { + "LiadOz/nvim-dap-repl-highlights", + config = true, + }, + { "JoosepAlviste/nvim-ts-context-commentstring", config = true, }, diff --git a/nvim/.config/nvim/lua/tobyvin/utils.lua b/nvim/.config/nvim/lua/tobyvin/utils.lua index 40d45e9..82f7a27 100644 --- a/nvim/.config/nvim/lua/tobyvin/utils.lua +++ b/nvim/.config/nvim/lua/tobyvin/utils.lua @@ -5,4 +5,33 @@ function M.inspect(v) return v end +--- Merges two or more highlights. +---@param ns integer Namespace +---@param name string name of new hl +---@param ... string|table|{ [1]: integer, [2]: string|table } Two or more hl names, definitions, or tuples of {ns, name|definition} +function M.extend_hl(ns, name, ...) + local hl = {} + + for _, arg in pairs({ ... }) do + local hl_name_or_val, hl_ns, hl_val + if + vim.tbl_islist(arg --[[@as table]]) + then + hl_ns, hl_name_or_val = arg[1], arg[2] + else + hl_ns, hl_name_or_val = ns, arg --[[@as string|table]] + end + + if type(hl_name_or_val) == "string" then + hl_val = vim.api.nvim_get_hl(hl_ns, { name = hl_name_or_val, link = false }) + else + hl_val = hl_name_or_val + end + + hl = vim.tbl_extend("keep", hl, hl_val) + end + + vim.api.nvim_set_hl(ns, name, hl) +end + return M |