From 2486dba138db14d26c4576b73a657588a490eaad Mon Sep 17 00:00:00 2001 From: Amanda Graven Date: Wed, 19 Apr 2023 10:43:45 +0200 Subject: [PATCH] Bash debug adapter, adjust diffopt --- init.lua | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index c716382..9b3bec0 100644 --- a/init.lua +++ b/init.lua @@ -49,6 +49,7 @@ opt.fillchars = { -- Characters to fill certain types of empty space diff = ' ', fold = ' ', } +opt.diffopt:append({'indent-heuristic', 'algorithm:histogram'}) o.tabstop = 4 -- A physical tab is 4 characters wide o.shiftwidth = 4 -- A unit of indentention is 4 levels wide @@ -294,8 +295,8 @@ require'packer'.startup(function(use) local null_ls = require'null-ls' null_ls.setup { sources = { + null_ls.builtins.diagnostics.zsh, null_ls.builtins.code_actions.shellcheck, - null_ls.builtins.diagnostics.shellcheck, } } end} @@ -323,6 +324,10 @@ require'packer'.startup(function(use) args = {'--port', '${port}'}, }, } + dap.adapters.sh = { + type = 'executable', + command = vim.fn.stdpath('data') .. '/mason/packages/bash-debug-adapter/bash-debug-adapter' + } dap.configurations.cpp = { { name = 'Launch file', @@ -336,7 +341,26 @@ require'packer'.startup(function(use) }, } dap.configurations.rust = dap.configurations.cpp - dap.configurations.c = dap.configurations.c + dap.configurations.c = dap.configurations.cpp + dap.configurations.sh = { + { + name = 'Bash debugger', + type = 'sh', + request = 'launch', + program = '${file}', + cwd = '${fileDirname}', + pathBashdb = vim.fn.stdpath('data') .. '/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb', + pathBashdbLib = vim.fn.stdpath('data') .. '/mason/packages/bash-debug-adapter/extension/bashdb_dir', + pathBash = 'bash', + pathCat = 'cat', + pathMkfifo = 'mkfifo', + pathPkill = 'pkill', + env = {}, + args = function () + return vim.fn.split(vim.fn.input('Arguments: ', '', 'file')) + end, + }, + } local function conditional_breakpoint() vim.ui.input({prompt = 'Breakpoint condition'}, function(condition) if not condition then return end