From a20229a39ebea62fa40ced9762162554c79b06fd Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 28 Sep 2023 15:28:22 +0200 Subject: added dap en dap-ui configuration --- config/essentials/nvim/after/plugin/dap.lua | 39 +++++++++++ config/essentials/nvim/after/plugin/dapui.lua | 94 +++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 config/essentials/nvim/after/plugin/dap.lua create mode 100644 config/essentials/nvim/after/plugin/dapui.lua (limited to 'config/essentials/nvim/after/plugin') diff --git a/config/essentials/nvim/after/plugin/dap.lua b/config/essentials/nvim/after/plugin/dap.lua new file mode 100644 index 0000000..8c0a739 --- /dev/null +++ b/config/essentials/nvim/after/plugin/dap.lua @@ -0,0 +1,39 @@ +local dap = require('dap') + +dap.adapters.coreclr = { + type = 'executable', + command = 'netcoredbg', + args = {'--interpreter=vscode'} +} + +dap.configurations.cs = { + { + type = "coreclr", + name = "launch - netcoredbg", + request = "launch", + program = function() + return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file') + end, + }, +} + +local function nnoremap(rhs, lhs, bufopts, desc) + bufopts.desc = desc + vim.keymap.set("n", rhs, lhs, bufopts) +end +local bufopts = { noremap=true, silent=true } + + +nnoremap('' , dap.continue, bufopts, "Continue") +nnoremap('' , dap.step_over, bufopts, "Step over") +nnoremap('' , dap.step_into, bufopts, "Step into") +nnoremap('' , dap.step_out, bufopts, "Step out") +nnoremap('b' , dap.toggle_breakpoint, bufopts, "Toggle breakpoint") + +nnoremap('B' , function() dap.set_breakpoint(vim.fn.input('Breakpoint condition: ')) + end, bufopts, "Set breakpoint") +nnoremap('lp' , function() dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) + end, bufopts, "set breakpoint with log point message") + +nnoremap('dr' , dap.repl.open, bufopts, "Reply open") +nnoremap('dl' , dap.run_last, bufopts, "Run las") diff --git a/config/essentials/nvim/after/plugin/dapui.lua b/config/essentials/nvim/after/plugin/dapui.lua new file mode 100644 index 0000000..faec590 --- /dev/null +++ b/config/essentials/nvim/after/plugin/dapui.lua @@ -0,0 +1,94 @@ +local dap, dapui = require("dap"), require("dapui") + +dapui.setup({ + icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" }, + mappings = { + -- Use a table to apply multiple mappings + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + edit = "e", + repl = "r", + toggle = "t", + }, + -- Use this to override mappings for specific elements + element_mappings = { + -- Example: + -- stacks = { + -- open = "", + -- expand = "o", + -- } + }, + -- Expand lines larger than the window + -- Requires >= 0.7 + expand_lines = vim.fn.has("nvim-0.7") == 1, + -- Layouts define sections of the screen to place windows. + -- The position can be "left", "right", "top" or "bottom". + -- The size specifies the height/width depending on position. It can be an Int + -- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while + -- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns) + -- Elements are the elements shown in the layout (in order). + -- Layouts are opened in order so that earlier layouts take priority in window sizing. + layouts = { + { + elements = { + -- Elements can be strings or table with id and size keys. + { id = "scopes", size = 0.25 }, + "breakpoints", + "stacks", + "watches", + }, + size = 40, -- 40 columns + position = "left", + }, + { + elements = { + "repl", + "console", + }, + size = 0.25, -- 25% of total lines + position = "bottom", + }, + }, + controls = { + -- Requires Neovim nightly (or 0.8 when released) + enabled = true, + -- Display controls in this element + element = "repl", + icons = { + pause = "", + play = "", + step_into = "", + step_over = "", + step_out = "", + step_back = "", + run_last = "↻", + terminate = "□", + }, + }, + floating = { + max_height = nil, -- These can be integers or a float between 0 and 1. + max_width = nil, -- Floats will be treated as percentage of your screen. + border = "single", -- Border style. Can be "single", "double" or "rounded" + mappings = { + close = { "q", "" }, + }, + }, + windows = { indent = 1 }, + render = { + max_type_length = nil, -- Can be integer or nil. + max_value_lines = 100, -- Can be integer or nil. + } +}) + + +dap.listeners.after.event_initialized["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 + -- cgit v1.2.3 From 2c603076ebaa4d00f95614052c5868c99aca738d Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 4 Oct 2023 02:54:37 +0200 Subject: added fdie snippet --- config/essentials/nvim/after/plugin/luasnip.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'config/essentials/nvim/after/plugin') diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua index 5657560..a98fe82 100644 --- a/config/essentials/nvim/after/plugin/luasnip.lua +++ b/config/essentials/nvim/after/plugin/luasnip.lua @@ -155,6 +155,10 @@ ls.add_snippets("sh", { stty \$old_stty_cfg } ]], {}), + parse("fdie", + [[ + die () { >&2 printf '%s\n' "\$@"; exit 1; } + ]], {}), parse("flogn", [[ logn () { >&2 printf '%s\n' "\$@"; } -- cgit v1.2.3 From bdfb02015178aabdb80320e9355fb33517c7f240 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 4 Oct 2023 02:55:09 +0200 Subject: added dap disconnect remap --- config/essentials/nvim/after/plugin/dap.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'config/essentials/nvim/after/plugin') diff --git a/config/essentials/nvim/after/plugin/dap.lua b/config/essentials/nvim/after/plugin/dap.lua index 8c0a739..e32b5ee 100644 --- a/config/essentials/nvim/after/plugin/dap.lua +++ b/config/essentials/nvim/after/plugin/dap.lua @@ -25,6 +25,7 @@ local bufopts = { noremap=true, silent=true } nnoremap('' , dap.continue, bufopts, "Continue") +nnoremap('' , dap.disconnect, bufopts, "Continue") nnoremap('' , dap.step_over, bufopts, "Step over") nnoremap('' , dap.step_into, bufopts, "Step into") nnoremap('' , dap.step_out, bufopts, "Step out") -- cgit v1.2.3 From 7082e91ec427726f8da60c990b4ca0edf541c3de Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 8 Oct 2023 13:10:03 +0200 Subject: added 'cw' snippet for cs --- config/essentials/nvim/after/plugin/luasnip.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'config/essentials/nvim/after/plugin') diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua index a98fe82..3f607ab 100644 --- a/config/essentials/nvim/after/plugin/luasnip.lua +++ b/config/essentials/nvim/after/plugin/luasnip.lua @@ -206,6 +206,10 @@ ls.add_snippets("javascript", { { i(1), rep(1), i(0) })), }) +ls.add_snippets("cs", { + parse("cw", "Console.WriteLine($1);$0"), +}) + ls.add_snippets("telekasten", { --link s("ln", fmt( -- cgit v1.2.3