From 90033636e505fcd4dee6629d1fb04f7930e2c0a1 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Tue, 30 Jan 2024 17:27:26 +0000 Subject: [PATCH] dap and nerdtree fixes --- vim/.vim/lua/plugins/dap.lua | 56 ++++++++++++++++++++++++++++++-- vim/.vim/lua/plugins/google.lua | 3 +- vim/.vim/lua/plugins/neotree.lua | 34 ++++--------------- zsh/.zshrc | 3 ++ 4 files changed, 65 insertions(+), 31 deletions(-) diff --git a/vim/.vim/lua/plugins/dap.lua b/vim/.vim/lua/plugins/dap.lua index 7d03601..47ce43b 100644 --- a/vim/.vim/lua/plugins/dap.lua +++ b/vim/.vim/lua/plugins/dap.lua @@ -20,9 +20,30 @@ return { { "dt", ":Telescope dap configurations" }, }, config = function() + local use_google = require("utils").use_google require("telescope").load_extension("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.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 = { type = "server", @@ -30,12 +51,41 @@ return { 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 = { { type = "java", request = "attach", mode = "remote", - name = "Java - Attach Remote", + name = "Attach Remote", cwd = "${workspaceFolder}", hostName = "127.0.0.1", port = 5005, @@ -43,14 +93,14 @@ return { } dap.configurations.gdscript = { { - name = "Godot - Launch Project", + name = "Launch Project", type = "godot", request = "launch", project = "${workspaceFolder}", additional_options = "", }, { - name = "Godot - Launch Current File", + name = "Launch Current File", type = "godot", request = "launch", scene = "current", diff --git a/vim/.vim/lua/plugins/google.lua b/vim/.vim/lua/plugins/google.lua index 800d0e8..442cdd3 100644 --- a/vim/.vim/lua/plugins/google.lua +++ b/vim/.vim/lua/plugins/google.lua @@ -30,11 +30,11 @@ return { glug("alert"), glug("csearch"), glug("languages"), - -- glug("googlestyle"), glug("googlespell"), -- Enable logmsgs ASAP to avoid maktaba's log message queue filling up veryLazy(glug("logmsgs")), veryLazy(glug("googler")), + glug("google-logo"), -- Add support for google filetypes veryLazy(glug("google-filetypes", { event = "BufReadPre", @@ -53,6 +53,7 @@ return { veryLazy(glug("ft-soy")), -- Configures nvim to respect Google's coding style veryLazy(glug("googlestyle")), + veryLazy(glug("add_usings")), -- Autogens boilerplate when creating new files glug("autogen", { event = "BufNewFile", diff --git a/vim/.vim/lua/plugins/neotree.lua b/vim/.vim/lua/plugins/neotree.lua index a5b7b7f..975b594 100644 --- a/vim/.vim/lua/plugins/neotree.lua +++ b/vim/.vim/lua/plugins/neotree.lua @@ -2,6 +2,12 @@ return { { "nvim-neo-tree/neo-tree.nvim", branch = "v2.x", + -- cmd = { + -- "NeoTreeFocusToggle", + -- "NeoTreeFloatToggle", + -- "NeoTreeRevealToggle", + -- "NeoTreeShowToggle", + -- }, config = function() require("neo-tree").setup({ sources = { @@ -17,32 +23,6 @@ return { ["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, dependencies = { @@ -50,7 +30,7 @@ return { "MunifTanjim/nui.nvim", }, keys = { - { "", ":Neotree filesystem reveal toggle reveal_force_cwd", desc = "Open NeoTree" }, + { "", ":Neotree filesystem reveal toggle dir=%:p:h", desc = "Open NeoTree" }, }, }, } diff --git a/zsh/.zshrc b/zsh/.zshrc index bf423b1..f8e8ba6 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -100,6 +100,9 @@ typeset -Ag color colour prompt_google3() { 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]#/}") else GPROMPT=$(print -r -- "$PWD")