summaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/basic.lua1
-rw-r--r--lua/debugging.lua68
2 files changed, 69 insertions, 0 deletions
diff --git a/lua/basic.lua b/lua/basic.lua
new file mode 100644
index 0000000..4cfc121
--- /dev/null
+++ b/lua/basic.lua
@@ -0,0 +1 @@
+print('Hello from basic.lua')
diff --git a/lua/debugging.lua b/lua/debugging.lua
new file mode 100644
index 0000000..82f073b
--- /dev/null
+++ b/lua/debugging.lua
@@ -0,0 +1,68 @@
+-- Debuging setup for NeoVim
+
+local dap = require('dap')
+local dapui = require('dapui')
+
+--
+-- Adapters
+--
+dap.adapters.gdb = {
+ type = "executable",
+ command = "gdb",
+ args = { "-i", "dap" }
+}
+
+dap.adapters.php = {
+ type = "executable",
+ command = "node",
+ args = { '/usr/lib/node_modules/php-debug/out/phpDebug.js' }
+}
+
+--
+-- Configurations
+--
+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}",
+ },
+}
+
+dap.configurations.php = {
+ {
+ name = "Listen for Xdebug",
+ type = "php",
+ request = "launch",
+ port = 9003,
+ },
+}
+require("dap.ext.vscode").load_launchjs(vim.fn.getcwd() .. "/.vscode/launch.json", {})
+
+-- Set up some keybindings
+vim.keymap.set('n', '<Leader>db', function() dap.toggle_breakpoint() end)
+vim.keymap.set('n', '<Leader>dc', function() dap.continue() end)
+vim.keymap.set('n', '<Leader>dr', function() dap.repl.open() end)
+vim.keymap.set('n', '<F10>', function() dap.step_over() end)
+vim.keymap.set('n', '<F11>', function() dap.step_into() end)
+vim.keymap.set('n', '<F12>', function() dap.step_out() end)
+
+-- Set up the UI
+dapui.setup()
+
+dap.listeners.before.attach.dapui_config = function()
+ dapui.open()
+end
+dap.listeners.before.launch.dapui_config = function()
+ dapui.open()
+end
+dap.listeners.before.event_terminated.dapui_config = function()
+ dapui.close()
+end
+dap.listeners.before.event_exited.dapui_config = function()
+ dapui.close()
+end