From 6be1147cc05db5ee0158e40fe43f3fe15429d04a Mon Sep 17 00:00:00 2001 From: Nigel Barink Date: Sun, 31 Mar 2024 22:30:23 +0200 Subject: [PATCH] FEAT: Added virtual text to Debug Adapter Protocol and added hover autocommand FIX: Debuggin keymaps --- lua/barink/keys.lua | 6 +++--- lua/barink/plugins/dap.lua | 7 +++++++ lua/barink/vim.lua | 10 ++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lua/barink/keys.lua b/lua/barink/keys.lua index 551b2fe..4b6dcd4 100644 --- a/lua/barink/keys.lua +++ b/lua/barink/keys.lua @@ -35,7 +35,7 @@ vim.keymap.set('n', 'dp', function () vim.diagnostic.goto_prev() end ) -- Debugging vim.keymap.set('n', 'sb', function () require('dap').toggle_breakpoint() end ) vim.keymap.set('n', 'db', function () require('dapui').toggle() end ) -vim.keymap.set('n', 'F5', function () require('dap').continue() end ) -vim.keymap.set('n', 'F6', function () require('dap').step_over() end ) -vim.keymap.set('n', 'F7', function () require('dap').step_into() end ) +vim.keymap.set('n', '', function () print("Start debug session" ) require('dap').continue() end ) +vim.keymap.set('n', '', function () require('dap').step_over() end ) +vim.keymap.set('n', '', function () require('dap').step_into() end ) diff --git a/lua/barink/plugins/dap.lua b/lua/barink/plugins/dap.lua index 9880737..8689e2d 100644 --- a/lua/barink/plugins/dap.lua +++ b/lua/barink/plugins/dap.lua @@ -12,6 +12,13 @@ return { require("dapui").setup() end }, + { + 'theHamsta/nvim-dap-virtual-text', + config = function() + require("nvim-dap-virtual-text").setup() + end + } + }, config = function () local dap = require('dap') diff --git a/lua/barink/vim.lua b/lua/barink/vim.lua index 5e39c05..8b73673 100644 --- a/lua/barink/vim.lua +++ b/lua/barink/vim.lua @@ -25,3 +25,13 @@ vim.g.netrw_browse_split = 0 vim.g.netrw_winsize = 25 vim.opt.completeopt = {'menu', 'menuone', 'noselect' } + +vim.api.nvim_create_autocmd('LspAttach', { + callback = function (args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client.server_capabilities.hoverProvider then + vim.keymap.set('n', 'K', vim.lsp.buf.hover, {buffer = args.buf}) + end + end, +}) +