more improvements

This commit is contained in:
2026-06-11 18:44:55 +02:00
parent 9af90374e2
commit 3c24466dd8
2 changed files with 28 additions and 27 deletions
+24 -24
View File
@@ -1,57 +1,57 @@
local map = vim.keymap.set local map = vim.keymap.set
local silent = { silent = true }
-- Clear search highlighting on Escape -- Clear search highlighting on Escape
map("n", "<Esc>", "<cmd>nohlsearch<cr>", silent) map("n", "<Esc>", "<cmd>nohlsearch<cr>", { silent = true, desc = "Clear search highlight" })
-- Visual line navigation -- Visual line navigation (move by display line over wrapped text)
for _, mode in ipairs({ "n", "x" }) do for _, mode in ipairs({ "n", "x" }) do
map(mode, "j", "gj", silent) map(mode, "j", "gj", { silent = true, desc = "Down (display line)" })
map(mode, "k", "gk", silent) map(mode, "k", "gk", { silent = true, desc = "Up (display line)" })
end end
-- Hover: native LSP hover (press K again to focus the window). -- Hover: native LSP hover (press K again to focus the window).
-- Border comes from the global `winborder` option. -- Border comes from the global `winborder` option.
map("n", "K", function() vim.lsp.buf.hover({ max_width = 80 }) end, map("n", "K", function() vim.lsp.buf.hover({ max_width = 80 }) end,
{ desc = "LSP hover" }) { desc = "LSP: hover docs" })
-- LSP (rename/code-action/references use native gr* defaults on 0.11+) -- LSP (rename/code-action/references use native gr* defaults on 0.11+)
map("n", "<leader>gf", map("n", "<leader>gf",
function() require("conform").format({ lsp_format = "fallback" }) end, function() require("conform").format({ lsp_format = "fallback" }) end,
{ desc = "Format buffer" }) { desc = "LSP: format buffer" })
map("n", "<leader>gd", vim.lsp.buf.definition) map("n", "<leader>gd", vim.lsp.buf.definition, { desc = "LSP: go to definition" })
map("n", "<leader>gD", vim.lsp.buf.declaration) map("n", "<leader>gD", vim.lsp.buf.declaration, { desc = "LSP: go to declaration" })
-- Trouble -- Trouble
map("n", "<leader>xx", "<cmd>Trouble diagnostics toggle focus=true<cr>", map("n", "<leader>xx", "<cmd>Trouble diagnostics toggle focus=true<cr>",
{ desc = "Diagnostics (Trouble)" }) { desc = "Trouble: workspace diagnostics" })
map("n", "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0 focus=true<cr>", map("n", "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0 focus=true<cr>",
{ desc = "Buffer Diagnostics (Trouble)" }) { desc = "Trouble: buffer diagnostics" })
map("n", "<leader>xt", "<cmd>Trouble todo toggle<cr>", { desc = "Todo (Trouble)" }) map("n", "<leader>xt", "<cmd>Trouble todo toggle<cr>", { desc = "Trouble: todo list" })
-- Pickers / files -- Pickers / files
map("n", "<C-f>", "<cmd>Pick files<cr>") map("n", "<C-f>", "<cmd>Pick files<cr>", { desc = "Find: files" })
map("n", "<C-g>", "<cmd>Pick grep_live<cr>") map("n", "<C-g>", "<cmd>Pick grep_live<cr>", { desc = "Find: grep project (disk)" })
map("n", "<C-b>", "<cmd>Pick buffers<cr>") map("n", "<C-S-g>", "<cmd>Pick buf_lines scope='all'<cr>", { desc = "Find: grep open buffers" })
map("n", "<C-h>", "<cmd>Pick help<cr>") map("n", "<C-b>", "<cmd>Pick buffers<cr>", { desc = "Find: buffers" })
map("n", "<C-e>", "<cmd>Oil<cr>") map("n", "<C-h>", "<cmd>Pick help<cr>", { desc = "Find: help tags" })
map("n", "<C-k>", "<cmd>Pick keymaps<cr>") map("n", "<C-e>", "<cmd>Oil<cr>", { desc = "File explorer (Oil)" })
map("n", "<C-k>", "<cmd>Pick keymaps<cr>", { desc = "Find: keymaps" })
-- DAP -- DAP
map("n", "<leader>duo", function() require("dapui").open() end) map("n", "<leader>duo", function() require("dapui").open() end, { desc = "Debug: open UI" })
map("n", "<leader>duc", function() require("dapui").close() end) map("n", "<leader>duc", function() require("dapui").close() end, { desc = "Debug: close UI" })
map("n", "<leader>dbp", function() require("dap").toggle_breakpoint() end) map("n", "<leader>dbp", function() require("dap").toggle_breakpoint() end, { desc = "Debug: toggle breakpoint" })
map("n", "<leader>drc", function() require("dap").run_to_cursor() end) map("n", "<leader>drc", function() require("dap").run_to_cursor() end, { desc = "Debug: run to cursor" })
-- Spell -- Spell
map("n", "<leader>sc", function() map("n", "<leader>sc", function()
vim.wo.spell = not vim.wo.spell vim.wo.spell = not vim.wo.spell
vim.notify("Spell: " .. (vim.wo.spell and "ON" or "OFF")) vim.notify("Spell: " .. (vim.wo.spell and "ON" or "OFF"))
end, { desc = "Toggle spell" }) end, { desc = "Spell: toggle" })
map("n", "<leader>sl", function() map("n", "<leader>sl", function()
local cur = vim.opt.spelllang:get()[1] or "" local cur = vim.opt.spelllang:get()[1] or ""
local new = cur == "en" and "de" or "en" local new = cur == "en" and "de" or "en"
vim.opt.spelllang = new vim.opt.spelllang = new
vim.notify("Spell lang: " .. new) vim.notify("Spell lang: " .. new)
end, { desc = "Switch spell language" }) end, { desc = "Spell: switch language (en/de)" })
+4 -3
View File
@@ -191,9 +191,9 @@ local function silicon_shot(to_clipboard)
if to_clipboard then s.clip() else s.file() end if to_clipboard then s.clip() else s.file() end
end end
vim.keymap.set("x", "<leader>cc", function() silicon_shot(true) end, vim.keymap.set("x", "<leader>cc", function() silicon_shot(true) end,
{ desc = "Silicon copy" }) { desc = "Silicon: copy code screenshot to clipboard" })
vim.keymap.set("x", "<leader>cs", function() silicon_shot(false) end, vim.keymap.set("x", "<leader>cs", function() silicon_shot(false) end,
{ desc = "Silicon save" }) { desc = "Silicon: save code screenshot to file" })
require("lualine").setup({ options = { theme = "gruvbox_dark" } }) require("lualine").setup({ options = { theme = "gruvbox_dark" } })
@@ -232,7 +232,8 @@ local textobj = {
} }
for lhs, query in pairs(textobj) do for lhs, query in pairs(textobj) do
vim.keymap.set({ "x", "o" }, lhs, vim.keymap.set({ "x", "o" }, lhs,
function() tso.select_textobject(query, "textobjects") end) function() tso.select_textobject(query, "textobjects") end,
{ desc = "Textobject: " .. query:gsub("@", "") })
end end
-- Mason: ensure tools -- Mason: ensure tools