From 9df505886a2925b5da0ccb5a2ee99022790c870f Mon Sep 17 00:00:00 2001 From: ant Date: Thu, 7 Mar 2024 14:08:08 +0100 Subject: [PATCH] Add DAP, mini.align, leetcode plugins --- lua/configs/dap.lua | 18 ++++++++++++++++++ lua/mappings.lua | 13 ++++++++++++- lua/plugins.lua | 46 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 lua/configs/dap.lua diff --git a/lua/configs/dap.lua b/lua/configs/dap.lua new file mode 100644 index 0000000..b5d80b7 --- /dev/null +++ b/lua/configs/dap.lua @@ -0,0 +1,18 @@ + +local dap = require("dap") +dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { "-i", "dap" } +} +dap.configurations.c = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = "${workspaceFolder}", + }, +} diff --git a/lua/mappings.lua b/lua/mappings.lua index b8f62e5..b3d3eae 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -100,5 +100,16 @@ wk.register({ ["fm"] = { function() vim.lsp.buf.format { async = true } end, "Format" }, - }) + +-- DAP +local dap = require('dap') +local dapui = require('dapui') +vim.keymap.set('n', 'dc', dap.continue, { desc = "Continue" }) +vim.keymap.set('n', '', dap.continue, { desc = "Continue" }) +vim.keymap.set('n', 's', dap.step_into, { desc = "Step into" }) +vim.keymap.set('n', 'n', dap.step_over, { desc = "Step over" }) +vim.keymap.set('n', 'o', dap.step_out, { desc = "Step out" }) +vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = "Toggle breakpoint" }) +vim.keymap.set('n', '', dap.toggle_breakpoint, { desc = "Toggle breakpoint" }) +vim.keymap.set('n', 'du', dapui.toggle, { desc = "Toggle UI" }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 63ef960..caf6cc0 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -434,6 +434,52 @@ local plugins = { uppercase_labels = true, }, }, + { + 'eandrju/cellular-automaton.nvim' + }, + { + "kawre/leetcode.nvim", + build = ":TSUpdate html", + dependencies = { + "nvim-telescope/telescope.nvim", + "nvim-lua/plenary.nvim", -- required by telescope + "MunifTanjim/nui.nvim", + + -- optional + "nvim-treesitter/nvim-treesitter", + "rcarriga/nvim-notify", + "nvim-tree/nvim-web-devicons", + }, + opts = { + -- configuration goes here + -- + lang = "c", + description = { + position = "right" + } + }, + }, + { + 'rcarriga/nvim-dap-ui', + dependencies = { 'mfussenegger/nvim-dap' }, + config = function() + require("configs.dap") + require("dapui").setup() + end + }, + { + 'echasnovski/mini.align', + version = false, + opts = { + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + start_with_preview = 'ga', + }, + options = { + justify_side = 'right', + }, + }, + } } return plugins