summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--nvim/.config/nvim/lua/tobyvin/options.lua1
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/dap.lua9
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/dap/adapters.lua25
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua43
4 files changed, 24 insertions, 54 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin/options.lua b/nvim/.config/nvim/lua/tobyvin/options.lua
index 9c15de2..858e5d9 100644
--- a/nvim/.config/nvim/lua/tobyvin/options.lua
+++ b/nvim/.config/nvim/lua/tobyvin/options.lua
@@ -43,6 +43,7 @@ vim.opt.spelloptions = { "camel", "noplainbuffer" }
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.swapfile = false
+vim.opt.switchbuf = "useopen,split,uselast"
vim.opt.tabstop = 4
vim.opt.termguicolors = true
vim.opt.textwidth = 100
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/dap.lua b/nvim/.config/nvim/lua/tobyvin/plugins/dap.lua
index 39743a3..a263c70 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins/dap.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/dap.lua
@@ -8,6 +8,12 @@ local M = {
{
"theHamsta/nvim-dap-virtual-text",
dependencies = { "nvim-treesitter/nvim-treesitter" },
+ opts = {
+ commented = true,
+ display_callback = function(variable)
+ return " " .. variable.value
+ end,
+ },
config = true,
},
},
@@ -45,9 +51,6 @@ function M.init()
end
function M.config()
- require("dap").defaults.fallback.focus_terminal = true
- require("dap").defaults.fallback.terminal_win_cmd = "15split new"
-
require("dap").listeners.after.event_initialized["User"] = function()
vim.api.nvim_exec_autocmds("User", { pattern = "DapAttach" })
end
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/dap/adapters.lua b/nvim/.config/nvim/lua/tobyvin/plugins/dap/adapters.lua
index e036e7c..4adb6bd 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins/dap/adapters.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/dap/adapters.lua
@@ -10,16 +10,21 @@ M.lldb = {
name = "lldb",
}
-M.rt_lldb = M.lldb
+M.codelldb = function(on_config, _)
+ local codelldb_path = vim.fn.exepath("codelldb")
+ local liblldb_path = vim.fn.resolve(codelldb_path):gsub("/codelldb$", "/extension/lldb/lib/liblldb.so")
-M.codelldb = {
- type = "server",
- port = "${port}",
- host = "127.0.0.1",
- executable = {
- command = "/usr/lib/codelldb/adapter/codelldb",
- args = { "--liblldb", "/usr/lib/codelldb/lldb/lib/liblldb.so", "--port", "${port}" },
- },
-}
+ on_config({
+ type = "server",
+ port = "${port}",
+ host = "127.0.0.1",
+ executable = {
+ command = codelldb_path,
+ args = { "--liblldb", liblldb_path, "--port", "${port}" },
+ },
+ })
+end
+
+M.rt_lldb = M.codelldb
return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua b/nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua
index 4dcae1a..cbc3954 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/rust-tools.lua
@@ -12,8 +12,9 @@ local M = {
},
},
server = require("tobyvin.lsp.configs").rust_analyzer,
- dap = { adapter = false },
+ dap = { adapter = require("tobyvin.plugins.dap.adapters").codelldb },
},
+ config = true,
}
local function set_target()
@@ -58,41 +59,6 @@ local function set_target()
end)
end
-local term_open = {
- command_buf = nil,
-}
-
-function term_open.execute_command(command, args, cwd)
- local utils = require("rust-tools.utils.utils")
-
- local full_command = utils.chain_commands({
- utils.make_command_from_args("cd", { cwd }),
- utils.make_command_from_args(command, args),
- })
-
- utils.delete_buf(term_open.buf)
- term_open.buf = vim.api.nvim_create_buf(false, true)
- utils.split(false, term_open.buf)
-
- -- make the new buffer smaller
- utils.resize(false, "-5")
-
- -- close the buffer
- vim.keymap.set("n", "q", function()
- utils.delete_buf(term_open.buf)
- end, { buffer = term_open.buf })
-
- -- run the command
- vim.fn.termopen(full_command)
-
- -- when the buffer is closed, set the latest buf id to nil else there are
- -- some edge cases with the id being sit but a buffer not being open
- local function onDetach(_, _)
- term_open.buf = nil
- end
- vim.api.nvim_buf_attach(term_open.buf, false, { on_detach = onDetach })
-end
-
function M.init()
require("tobyvin.lsp.configs").rust_analyzer = nil
@@ -122,9 +88,4 @@ function M.init()
})
end
-function M.config(_, opts)
- require("rust-tools").setup(opts)
- require("rust-tools.executors.termopen").execute_command = term_open.execute_command
-end
-
return M