gabrielgio.lua @ c6df47c2a00b01b24233a57495a6584fe4f4ae3f

  1diff --git a/init.lua b/init.lua
  2index 4e78cd4e1921c15bedc103cdef54bfe532ab8855..97e759851d673b6b1c5639b835f8823f4f0e4bd0 100644
  3--- a/init.lua
  4+++ b/init.lua
  5@@ -25,6 +25,7 @@ local pkgs = {
  6     "folke/trouble.nvim",                           -- diagnostics
  7     "mfussenegger/nvim-dap",                        -- add dap support
  8     "nvim-neotest/nvim-nio",                        -- async support library
  9+    "rcarriga/nvim-dap-ui",                         -- dap ui
 10     "nvim-lua/plenary.nvim",                        -- base lib
 11     "nvim-telescope/telescope.nvim",                -- telescope
 12     "nvim-telescope/telescope-file-browser.nvim",   -- telescope file browser
 13diff --git a/lua/gabrielgio/dap.lua b/lua/gabrielgio/dap.lua
 14index c5f316b69f09c2c7f1459511d091736a08387093..c5059c6368c6163142295a766299d29be2b0ae8c 100644
 15--- a/lua/gabrielgio/dap.lua
 16+++ b/lua/gabrielgio/dap.lua
 17@@ -1,5 +1,6 @@
 18 local dap = require("dap")
 19 local key = require("gabrielgio.key")
 20+local dapui = require("dapui")
 21 
 22 key.nnoremap("<F5>", ":lua require'dap'.continue()<CR>")
 23 key.nnoremap("<F10>", ":lua require'dap'.step_over()<CR>")
 24@@ -8,6 +9,7 @@ key.nnoremap("<F12>", ":lua require'dap'.step_out()<CR>")
 25 key.nnoremap("<leader>b", ":lua require'dap'.toggle_breakpoint()<CR>")
 26 key.nnoremap("<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Condition: '))<CR>")
 27 key.nnoremap("<leader>dr", ":lua require'dap'.repl.open()<CR>")
 28+key.nnoremap("<Alt-k>", "<Cmd>lua require'dapui'.eval()<CR>")
 29 
 30 dap.adapters.delve = {
 31 	type = "server",
 32@@ -15,6 +17,19 @@ 	host = "127.0.0.1",
 33 	port = 2345,
 34 }
 35 
 36+dap.adapters.gdb = {
 37+	id = "gdb",
 38+	type = "executable",
 39+	command = "gdb",
 40+	args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
 41+}
 42+
 43+dap.adapters.lldb = {
 44+	type = "executable",
 45+	command = "lldb-vscode", -- adjust as needed, must be absolute path
 46+	name = "lldb",
 47+}
 48+
 49 dap.configurations.go = {
 50 	{
 51 		type = "delve",
 52@@ -27,3 +42,52 @@ 			port = "2345",
 53 		},
 54 	},
 55 }
 56+dap.configurations.zig = {
 57+	{
 58+		name = "Launch",
 59+		type = "gdb",
 60+		request = "launch",
 61+		program = function()
 62+			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
 63+		end,
 64+		cwd = "${workspaceFolder}",
 65+		stopAtBeginningOfMainSubprogram = false,
 66+		args = function()
 67+			local args_str = vim.fn.input({
 68+				prompt = "Arguments: ",
 69+			})
 70+			return vim.split(args_str, " +")
 71+		end,
 72+	},
 73+	{
 74+		name = "Launch",
 75+		type = "lldb",
 76+		request = "launch",
 77+		program = function()
 78+			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
 79+		end,
 80+		cwd = "${workspaceFolder}",
 81+		stopAtBeginningOfMainSubprogram = false,
 82+		args = function()
 83+			local args_str = vim.fn.input({
 84+				prompt = "Arguments: ",
 85+			})
 86+			return vim.split(args_str, " +")
 87+		end,
 88+	},
 89+}
 90+
 91+dapui.setup({
 92+	layouts = {
 93+		{
 94+			elements = {
 95+				{
 96+					id = "watches",
 97+					size = 1,
 98+				},
 99+			},
100+			position = "bottom",
101+			size = 10,
102+		},
103+	},
104+})