dap and nerdtree fixes

This commit is contained in:
Christian Nieves
2024-01-30 17:27:26 +00:00
parent 16fb43e7a2
commit 90033636e5
4 changed files with 65 additions and 31 deletions

View File

@ -20,9 +20,30 @@ return {
{ "<leader>dt", ":Telescope dap configurations<CR>" }, { "<leader>dt", ":Telescope dap configurations<CR>" },
}, },
config = function() config = function()
local use_google = require("utils").use_google
require("telescope").load_extension("dap") require("telescope").load_extension("dap")
local dap = require("dap") local dap = require("dap")
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DapBreakpointCondition", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DapBreakpointRejected", { text = "", texthl = "DiagnosticSignError" })
dap.adapters.java = {} dap.adapters.java = {}
dap.adapters.cpp = {}
if use_google then
dap.adapters.lldb = {
type = "executable",
-- sudo apt install google-lldb-vscode
command = "/usr/share/code/resources/app/extensions/google-lldb-vscode/bin/lldb-dap",
name = "lldb",
sourceMap = {
{ "/proc/self/cwd", "${workspaceFolder}" },
},
cwd = "${workspaceFolder}",
debuggerRoot = "${workspaceFolder}",
sourcePath = "${workspaceFolder}",
}
end
dap.adapters.godot = { dap.adapters.godot = {
type = "server", type = "server",
@ -30,12 +51,41 @@ return {
port = 6006, port = 6006,
} }
dap.configurations.cpp = {
{
-- If you get an "Operation not permitted" error using this, try disabling YAMA:
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
name = "Attach to process",
type = "lldb",
request = "attach",
pid = require("dap.utils").pick_process,
args = {},
},
{
name = "Wait for process name",
type = "lldb",
request = "attach",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
waitFor = true,
},
{
type = "lldb",
request = "attach",
mode = "remote",
name = "Attach Remote",
attachCommands = { "gdb-remote 5555" },
-- hostName = "127.0.0.1",
-- port = 5555,
},
}
dap.configurations.java = { dap.configurations.java = {
{ {
type = "java", type = "java",
request = "attach", request = "attach",
mode = "remote", mode = "remote",
name = "Java - Attach Remote", name = "Attach Remote",
cwd = "${workspaceFolder}", cwd = "${workspaceFolder}",
hostName = "127.0.0.1", hostName = "127.0.0.1",
port = 5005, port = 5005,
@ -43,14 +93,14 @@ return {
} }
dap.configurations.gdscript = { dap.configurations.gdscript = {
{ {
name = "Godot - Launch Project", name = "Launch Project",
type = "godot", type = "godot",
request = "launch", request = "launch",
project = "${workspaceFolder}", project = "${workspaceFolder}",
additional_options = "", additional_options = "",
}, },
{ {
name = "Godot - Launch Current File", name = "Launch Current File",
type = "godot", type = "godot",
request = "launch", request = "launch",
scene = "current", scene = "current",

View File

@ -30,11 +30,11 @@ return {
glug("alert"), glug("alert"),
glug("csearch"), glug("csearch"),
glug("languages"), glug("languages"),
-- glug("googlestyle"),
glug("googlespell"), glug("googlespell"),
-- Enable logmsgs ASAP to avoid maktaba's log message queue filling up -- Enable logmsgs ASAP to avoid maktaba's log message queue filling up
veryLazy(glug("logmsgs")), veryLazy(glug("logmsgs")),
veryLazy(glug("googler")), veryLazy(glug("googler")),
glug("google-logo"),
-- Add support for google filetypes -- Add support for google filetypes
veryLazy(glug("google-filetypes", { veryLazy(glug("google-filetypes", {
event = "BufReadPre", event = "BufReadPre",
@ -53,6 +53,7 @@ return {
veryLazy(glug("ft-soy")), veryLazy(glug("ft-soy")),
-- Configures nvim to respect Google's coding style -- Configures nvim to respect Google's coding style
veryLazy(glug("googlestyle")), veryLazy(glug("googlestyle")),
veryLazy(glug("add_usings")),
-- Autogens boilerplate when creating new files -- Autogens boilerplate when creating new files
glug("autogen", { glug("autogen", {
event = "BufNewFile", event = "BufNewFile",

View File

@ -2,6 +2,12 @@ return {
{ {
"nvim-neo-tree/neo-tree.nvim", "nvim-neo-tree/neo-tree.nvim",
branch = "v2.x", branch = "v2.x",
-- cmd = {
-- "NeoTreeFocusToggle",
-- "NeoTreeFloatToggle",
-- "NeoTreeRevealToggle",
-- "NeoTreeShowToggle",
-- },
config = function() config = function()
require("neo-tree").setup({ require("neo-tree").setup({
sources = { sources = {
@ -17,32 +23,6 @@ return {
["O"] = "expand_all_nodes", ["O"] = "expand_all_nodes",
}, },
}, },
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function(arg)
vim.opt.mouse = "a"
end,
},
{
event = "neo_tree_window_after_open",
handler = function(args)
vim.opt.mouse = "a"
end,
},
{
event = "neo_tree_buffer_leave",
handler = function(arg)
vim.opt.mouse = ""
end,
},
{
event = "neo_tree_window_after_close",
handler = function(arg)
vim.opt.mouse = ""
end,
},
},
}) })
end, end,
dependencies = { dependencies = {
@ -50,7 +30,7 @@ return {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
}, },
keys = { keys = {
{ "<C-n>", ":Neotree filesystem reveal toggle reveal_force_cwd<cr>", desc = "Open NeoTree" }, { "<C-n>", ":Neotree filesystem reveal toggle dir=%:p:h<cr>", desc = "Open NeoTree" },
}, },
}, },
} }

View File

@ -100,6 +100,9 @@ typeset -Ag color colour
prompt_google3() { prompt_google3() {
if [[ $PWD =~ '/google/src/cloud/[^/]+/(.+)/google3(.*)' ]]; then if [[ $PWD =~ '/google/src/cloud/[^/]+/(.+)/google3(.*)' ]]; then
# Use CitC client names as window titles in screen/tmux
print -n "\e]2;${match[1]}\a" >/dev/tty
GPROMPT=$(print -r -- "//${match[2]#/}") GPROMPT=$(print -r -- "//${match[2]#/}")
else else
GPROMPT=$(print -r -- "$PWD") GPROMPT=$(print -r -- "$PWD")