diff --git a/init.lua b/init.lua index 3939c4bf69c..cd46c10ebe6 100644 --- a/init.lua +++ b/init.lua @@ -487,8 +487,10 @@ require('lazy').setup { 'lewis6991/gitsigns.nvim', opts = { -- See `:help gitsigns.txt` + -- helper created by Kickstart but edited here earlier signs = { add = { text = '+' }, + change = { text = '~' }, delete = { text = '_' }, topdelete = { text = '‾' }, @@ -584,39 +586,6 @@ require('lazy').setup { end end - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - -- local client = vim.lsp.get_client_by_id(event.data.client_id) - -- if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then - -- local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - -- buffer = event.buf, - -- group = highlight_augroup, - -- callback = vim.lsp.buf.document_highlight, - -- }) - -- - -- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - -- buffer = event.buf, - -- group = highlight_augroup, - -- callback = vim.lsp.buf.clear_references, - -- }) - -- - -- vim.api.nvim_create_autocmd('LspDetach', { - -- group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - -- callback = function(event2) - -- vim.lsp.buf.clear_references() - -- vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - -- end, - -- }) - -- end - - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then gs_map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) @@ -625,17 +594,6 @@ require('lazy').setup { end, }, }, - - -- Change diagnostic symbols in the sign column (gutter) - -- if vim.g.have_nerd_font then - -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } - -- local diagnostic_signs = {} - -- for type, icon in pairs(signs) do - -- diagnostic_signs[vim.diagnostic.severity[type]] = icon - -- end - -- vim.diagnostic.config { signs = { text = diagnostic_signs } } - -- end - { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' @@ -1263,6 +1221,11 @@ require('lazy').setup { } end, }, + -- { + -- 'scottmckendry/cyberdream.nvim', + -- lazy = false, + -- priority = 1000, + -- }, { -- You can easily change to a different colorscheme. -- Change the name of the colorscheme plugin below, and then diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua new file mode 100644 index 00000000000..ee975e99bd8 --- /dev/null +++ b/lua/custom/plugins/debug.lua @@ -0,0 +1,137 @@ +---@diagnostic disable: undefined-global +return { + + -- ───────────── CORE DAP CLIENT ───────────── + { + 'mfussenegger/nvim-dap', -- Debug Adapter Protocol client + + opts = {}, -- keep the keymaps you already added + config = function() + local dap = require 'dap' + + -- 1. SIGN DEFINITIONS ─────────────────────────────────────────────────── + vim.fn.sign_define('DapBreakpoint', { text = '', texthl = 'DapBreakpoint', linehl = '', numhl = '' }) + vim.fn.sign_define('DapStopped', { text = '', texthl = 'DapStopped', linehl = 'DapStoppedLine', numhl = '' }) + + -- 2. HIGHLIGHTS (adapt the colours if you like) ──────────────────────── + -- NOTE: these are One Dark colours; change to match your colourscheme. + vim.api.nvim_set_hl(0, 'DapBreakpoint', { fg = '#E06C75' }) -- red + vim.api.nvim_set_hl(0, 'DapStopped', { fg = '#98C379' }) -- green + vim.api.nvim_set_hl(0, 'DapStoppedLine', { link = 'Visual' }) -- highlight whole line + end, + keys = { + { + '', + function() + require('dap').continue() + end, + desc = '∙ Start / Continue', + }, + { + '', + function() + require('dap').toggle_breakpoint() + end, + desc = '∙ Toggle Breakpoint', + }, + { + '', + function() + require('dap').step_over() + end, + desc = '∙ Step Over', + }, + { + '', + function() + require('dap').step_into() + end, + desc = '∙ Step Into', + }, + { + '', + function() + require('dap').step_out() + end, + desc = '∙ Step Out', + }, + }, + }, + + -- ───────────── NICE UI & INLINE VALUES ───────────── + { + 'rcarriga/nvim-dap-ui', + opts = {}, + config = function() + local dap, dapui = require 'dap', require 'dapui' + dapui.setup() + dap.listeners.after.event_initialized['dapui_auto'] = function() + dapui.open() + end + dap.listeners.before.event_terminated['dapui_auto'] = function() + dapui.close() + end + dap.listeners.before.event_exited['dapui_auto'] = function() + dapui.close() + end + end, + }, + { 'theHamsta/nvim-dap-virtual-text', opts = {} }, + + -- ───────────── AUTO-INSTALL CODELLDB ───────────── + { 'williamboman/mason.nvim' }, -- already in Kickstart, keep for order + { + 'jay-babu/mason-nvim-dap.nvim', + dependencies = { 'mfussenegger/nvim-dap', 'williamboman/mason.nvim' }, + opts = { ensure_installed = { 'codelldb' }, automatic_setup = true }, + }, + + -- ───────────── RUST INTEGRATION ───────────── + { + 'mrcjkb/rustaceanvim', -- use this OR rust-tools (uncomment below if you prefer) + version = '^4', + ft = 'rust', + config = function() + local mason = require 'mason-registry' + local codelldb_pkg = mason.get_package 'codelldb' + local ext = codelldb_pkg:get_install_path() .. '/extension/' + vim.g.rustaceanvim = { + dap = { + adapter = { + type = 'server', + port = '${port}', + executable = { command = ext .. 'adapter/codelldb', args = { '--port', '${port}' } }, + }, + }, + } + end, + }, + + --[[ -- Uncomment if you’d rather stay on rust-tools.nvim + { + "simrat39/rust-tools.nvim", + ft = "rust", + dependencies = { "mfussenegger/nvim-dap", "neovim/nvim-lspconfig" }, + config = function() + local mason_path = vim.fn.stdpath("data") .. "/mason/packages/codelldb/extension/" + require("rust-tools").setup({ + dap = { + adapter = require("rust-tools.dap").get_codelldb_adapter( + mason_path .. "adapter/codelldb", + mason_path .. "lldb/lib/liblldb.so" -- change to .dylib / .dll for macOS / Windows + ), + }, + }) + end, + }, + --]] + + -- ───────────── (OPTIONAL) Telescope picker for sessions ───────────── + { + 'nvim-telescope/telescope-dap.nvim', + dependencies = { 'nvim-telescope/telescope.nvim' }, + config = function() + require('telescope').load_extension 'dap' + end, + }, +}