1
0

add changes from work workstation

This commit is contained in:
2026-04-13 19:29:57 +02:00
parent 298e81add0
commit 7cc34cbda4
13 changed files with 319 additions and 51 deletions

View File

@@ -17,9 +17,38 @@ require("oil").setup({
view_options = {
show_hidden = true,
},
preview = {
max_width = 0.9,
min_width = { 40, 0.4 },
max_height = 0.9,
min_height = { 5, 0.1 },
},
float = {
max_width = math.floor(vim.o.columns * 0.66),
max_height = math.floor(vim.o.lines * 0.66),
},
keymaps = {
["<Esc><Esc>"] = { "actions.close", mode = "n" },
},
})
vim.keymap.set("n", "<leader>pv", "<cmd>Oil<cr>", { desc = "Open current directory" })
vim.api.nvim_create_autocmd("User", {
pattern = "OilEnter",
callback = vim.schedule_wrap(function(args)
local oil = require("oil")
if vim.api.nvim_get_current_buf() == args.data.buf and oil.get_current_dir() then
require("oil.actions").preview.callback()
end
end),
})
vim.keymap.set("n", "<leader>pv", function()
if vim.o.lines >= 40 and vim.o.columns >= 120 then
require("oil").open_float()
else
require("oil").open()
end
end, { desc = "Open file explorer" })
vim.keymap.set({ "n", "x", "o" }, "<leader>f", require("jump").start, {})
local function get_project_root()

View File

@@ -0,0 +1,158 @@
vim.pack.add({
{ src = "https://codeberg.org/mfussenegger/nvim-dap" },
})
local dap = require("dap")
-- GDB adapter for C/C++ (requires gdb 14.0+)
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
}
-- Rust-specific adapter using rust-gdb for pretty-printing Rust types
dap.adapters["rust-gdb"] = {
type = "executable",
command = "rust-gdb",
args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
}
-- Delve adapter for Go (uses delve's built-in DAP mode)
dap.adapters.delve = function(callback, config)
if config.mode == "remote" and config.request == "attach" then
callback({
type = "server",
host = config.host or "127.0.0.1",
port = config.port or "38697",
})
else
callback({
type = "server",
port = "${port}",
executable = {
command = "dlv",
args = { "dap", "-l", "127.0.0.1:${port}", "--log", "--log-output=dap" },
detached = vim.fn.has("win32") == 0,
},
})
end
end
-- C configurations
dap.configurations.c = {
{
name = "Launch",
type = "gdb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
args = function()
local input = vim.fn.input("Arguments: ")
return vim.split(input, " ", { trimempty = true })
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = "Attach to process",
type = "gdb",
request = "attach",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
pid = function()
local name = vim.fn.input("Executable name (filter): ")
return require("dap.utils").pick_process({ filter = name })
end,
cwd = "${workspaceFolder}",
},
}
dap.configurations.cpp = dap.configurations.c
-- Rust configurations (using rust-gdb for pretty-printed types)
dap.configurations.rust = {
{
name = "Launch",
type = "rust-gdb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug/", "file")
end,
args = function()
local input = vim.fn.input("Arguments: ")
return vim.split(input, " ", { trimempty = true })
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = "Attach to process",
type = "rust-gdb",
request = "attach",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug/", "file")
end,
pid = function()
local name = vim.fn.input("Executable name (filter): ")
return require("dap.utils").pick_process({ filter = name })
end,
cwd = "${workspaceFolder}",
},
}
-- Go configurations (using delve)
dap.configurations.go = {
{
type = "delve",
name = "Debug",
request = "launch",
program = "${file}",
},
{
type = "delve",
name = "Debug test",
request = "launch",
mode = "test",
program = "${file}",
},
{
type = "delve",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}",
},
}
-- Breakpoint signs
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "" })
vim.fn.sign_define("DapBreakpointCondition", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "" })
vim.fn.sign_define("DapStopped", { text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "" })
-- Keybindings
vim.keymap.set("n", "<leader>gdb", dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
vim.keymap.set("n", "<leader>gdB", function()
dap.set_breakpoint(vim.fn.input("Breakpoint condition: "))
end, { desc = "Conditional breakpoint" })
vim.keymap.set("n", "<leader>gdc", dap.continue, { desc = "Continue / Launch" })
vim.keymap.set("n", "<leader>gds", dap.step_over, { desc = "Step over" })
vim.keymap.set("n", "<leader>gdi", dap.step_into, { desc = "Step into" })
vim.keymap.set("n", "<leader>gdo", dap.step_out, { desc = "Step out" })
vim.keymap.set("n", "<leader>gdr", dap.repl.open, { desc = "Open REPL" })
vim.keymap.set("n", "<leader>gdl", dap.run_last, { desc = "Run last" })
vim.keymap.set("n", "<leader>gdt", dap.terminate, { desc = "Terminate" })
vim.keymap.set("n", "<leader>gdh", function()
require("dap.ui.widgets").hover()
end, { desc = "Hover variable" })
vim.keymap.set("v", "<leader>gdh", function()
require("dap.ui.widgets").hover()
end, { desc = "Hover selection" })
vim.keymap.set("n", "<leader>gdF", function()
require("dap.ui.widgets").centered_float(require("dap.ui.widgets").frames)
end, { desc = "Show frames" })
vim.keymap.set("n", "<leader>gdS", function()
require("dap.ui.widgets").centered_float(require("dap.ui.widgets").scopes)
end, { desc = "Show scopes" })

View File

@@ -3,4 +3,5 @@ require("plugins.tmux")
require("plugins.ui")
require("plugins.formatting")
require("plugins.linting")
require("plugins.debugging")
require("plugins.ai")

View File

@@ -6,24 +6,59 @@ vim.opt.cmdheight = 2 -- more space in the neovim command line for displaying me
vim.pack.add({
{ src = "https://github.com/rose-pine/neovim" },
{ src = "https://github.com/zaldih/themery.nvim" },
{ src = "https://github.com/brenoprata10/nvim-highlight-colors" },
})
require("themery").setup({
-- add the config here
themes = { "rose-pine-dawn", "rose-pine-main" }, -- Your list of installed colorschemes.
livePreview = true, -- Apply theme while picking. Default to true.
})
-- Sync background with tmux rose-pine variant
if vim.env.TMUX then
local variant = vim.fn.system("tmux show-option -gqv @rose_pine_variant"):gsub("%s+", "")
vim.o.background = variant == "dawn" and "light" or "dark"
else
vim.o.background = "dark"
end
vim.cmd.colorscheme("rose-pine")
vim.keymap.set("n", "<leader>tt", function()
local themery = require("themery")
local currentTheme = themery.getCurrentTheme()
if currentTheme and currentTheme.name == "rose-pine-dawn" then
themery.setThemeByName("rose-pine-main", true)
vim.o.background = vim.o.background == "dark" and "light" or "dark"
end, { desc = "Alternate between light and dark mode" })
-- Insert-mode cursor: extmark overlay for full fg+bg control (terminal ignores fg on cursor hl groups)
local function set_icursor_hl()
if vim.o.background == "light" then
vim.api.nvim_set_hl(0, "iCursorChar", { fg = "#fffaf3", bg = "#b4637a" }) -- dawn: surface / love
else
themery.setThemeByName("rose-pine-dawn", true)
vim.api.nvim_set_hl(0, "iCursorChar", { fg = "#1f1d2e", bg = "#eb6f92" }) -- main: surface / love
end
end, { noremap = true, desc = "Alternate between light and dark mode" })
end
set_icursor_hl()
vim.api.nvim_create_autocmd({ "ColorScheme", "OptionSet" }, {
pattern = { "*", "background" },
callback = set_icursor_hl,
})
local icursor_ns = vim.api.nvim_create_namespace("icursor")
local function update_icursor()
vim.api.nvim_buf_clear_namespace(0, icursor_ns, 0, -1)
local r, c = unpack(vim.api.nvim_win_get_cursor(0))
local line = vim.api.nvim_get_current_line()
local char = c < #line and line:sub(c + 1, c + 1) or " "
vim.api.nvim_buf_set_extmark(0, icursor_ns, r - 1, c, {
virt_text = { { char, "iCursorChar" } },
virt_text_pos = "overlay",
})
end
vim.api.nvim_create_autocmd("ModeChanged", { pattern = "*:i*", callback = update_icursor })
vim.api.nvim_create_autocmd("CursorMovedI", { callback = update_icursor })
vim.api.nvim_create_autocmd("ModeChanged", {
pattern = "i*:*",
callback = function()
vim.api.nvim_buf_clear_namespace(0, icursor_ns, 0, -1)
end,
})
require("nvim-highlight-colors").setup()