gabrielgio.lua @ c6df47c2a00b01b24233a57495a6584fe4f4ae3f

diff --git a/init.lua b/init.lua
index 4e78cd4e1921c15bedc103cdef54bfe532ab8855..97e759851d673b6b1c5639b835f8823f4f0e4bd0 100644
--- a/init.lua
+++ b/init.lua
@@ -25,6 +25,7 @@ local pkgs = {
     "folke/trouble.nvim",                           -- diagnostics
     "mfussenegger/nvim-dap",                        -- add dap support
     "nvim-neotest/nvim-nio",                        -- async support library
+    "rcarriga/nvim-dap-ui",                         -- dap ui
     "nvim-lua/plenary.nvim",                        -- base lib
     "nvim-telescope/telescope.nvim",                -- telescope
     "nvim-telescope/telescope-file-browser.nvim",   -- telescope file browser
diff --git a/lua/gabrielgio/dap.lua b/lua/gabrielgio/dap.lua
index c5f316b69f09c2c7f1459511d091736a08387093..c5059c6368c6163142295a766299d29be2b0ae8c 100644
--- a/lua/gabrielgio/dap.lua
+++ b/lua/gabrielgio/dap.lua
@@ -1,5 +1,6 @@
 local dap = require("dap")
 local key = require("gabrielgio.key")
+local dapui = require("dapui")
 
 key.nnoremap("<F5>", ":lua require'dap'.continue()<CR>")
 key.nnoremap("<F10>", ":lua require'dap'.step_over()<CR>")
@@ -8,6 +9,7 @@ key.nnoremap("<F12>", ":lua require'dap'.step_out()<CR>")
 key.nnoremap("<leader>b", ":lua require'dap'.toggle_breakpoint()<CR>")
 key.nnoremap("<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Condition: '))<CR>")
 key.nnoremap("<leader>dr", ":lua require'dap'.repl.open()<CR>")
+key.nnoremap("<Alt-k>", "<Cmd>lua require'dapui'.eval()<CR>")
 
 dap.adapters.delve = {
 	type = "server",
@@ -15,6 +17,19 @@ 	host = "127.0.0.1",
 	port = 2345,
 }
 
+dap.adapters.gdb = {
+	id = "gdb",
+	type = "executable",
+	command = "gdb",
+	args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
+}
+
+dap.adapters.lldb = {
+	type = "executable",
+	command = "lldb-vscode", -- adjust as needed, must be absolute path
+	name = "lldb",
+}
+
 dap.configurations.go = {
 	{
 		type = "delve",
@@ -27,3 +42,52 @@ 			port = "2345",
 		},
 	},
 }
+dap.configurations.zig = {
+	{
+		name = "Launch",
+		type = "gdb",
+		request = "launch",
+		program = function()
+			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
+		end,
+		cwd = "${workspaceFolder}",
+		stopAtBeginningOfMainSubprogram = false,
+		args = function()
+			local args_str = vim.fn.input({
+				prompt = "Arguments: ",
+			})
+			return vim.split(args_str, " +")
+		end,
+	},
+	{
+		name = "Launch",
+		type = "lldb",
+		request = "launch",
+		program = function()
+			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
+		end,
+		cwd = "${workspaceFolder}",
+		stopAtBeginningOfMainSubprogram = false,
+		args = function()
+			local args_str = vim.fn.input({
+				prompt = "Arguments: ",
+			})
+			return vim.split(args_str, " +")
+		end,
+	},
+}
+
+dapui.setup({
+	layouts = {
+		{
+			elements = {
+				{
+					id = "watches",
+					size = 1,
+				},
+			},
+			position = "bottom",
+			size = 10,
+		},
+	},
+})