diff --git a/symlinks/config/nvim/plugin/ale.vim b/symlinks/config/nvim/plugin/ale.vim index 4d8554c..d72a320 100644 --- a/symlinks/config/nvim/plugin/ale.vim +++ b/symlinks/config/nvim/plugin/ale.vim @@ -12,7 +12,8 @@ let g:ale_linters.python = ['flake8'] let g:ale_linters.kotlin = ['ktlint'] let g:ale_linters.clojure = [] let g:ale_linters.cs = ['OmniSharp'] -let g:ale_linters.cpp = ['clangd'] +let g:ale_linters.cpp = ['clang'] +let g:ale_linters.c = g:ale_linters.cpp " ALE Fixers configuration let g:ale_fixers = {} @@ -22,6 +23,7 @@ let g:ale_fixers.dart = ['dartfmt'] let g:ale_fixers.lua = ['luafmt'] let g:ale_fixers.go = ['gofmt'] let g:ale_fixers.cpp = ['clang-format', 'clangtidy'] +let g:ale_fixers.c = g:ale_fixers.cpp let g:ale_fixers.cmake = ['cmakeformat'] let g:ale_fixers.java = ['google_java_format'] let g:ale_fixers.rust = ['rustfmt'] diff --git a/symlinks/config/nvim/plugin/dap.lua b/symlinks/config/nvim/plugin/dap.lua index 3126fe9..58f3e62 100644 --- a/symlinks/config/nvim/plugin/dap.lua +++ b/symlinks/config/nvim/plugin/dap.lua @@ -29,7 +29,8 @@ set_keymap("n", "dsi", "lua require'dap'.step_into()", default_ set_keymap("n", "dro", "lua require'dap'.open()", default_opts) -- Nvim DAP UI -require("dapui").setup() +local dapui = require("dapui") +dapui.setup() -- Debugger Hover map local api = vim.api @@ -53,3 +54,56 @@ dap.listeners.after["event_terminated"]["me"] = function() end keymap_restore = {} end + +-- Additional servers +dap.adapters.lldb = { + type = "executable", + command = "lldb-vscode", + name = "lldb" +} + +dap.configurations.cpp = { + { + name = "Launch", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = {}, + -- 💀 + -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: + -- + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + -- + -- Otherwise you might get the following error: + -- + -- Error on launch: Failed to attach to the target process + -- + -- But you should be aware of the implications: + -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html + + runInTerminal = false, + -- 💀 + -- If you use `runInTerminal = true` and resize the terminal window, + -- lldb-vscode will receive a `SIGWINCH` signal which can cause problems + -- To avoid that uncomment the following option + -- See https://github.com/mfussenegger/nvim-dap/issues/236#issuecomment-1066306073 + postRunCommands = {"process handle -p true -s false -n false SIGWINCH"} + } +} + +dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp + +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