refactor: simplify

This commit is contained in:
2026-09-03 19:50:47 +02:00
parent 11edf1e7d1
commit 29d7fd98c8
5 changed files with 45 additions and 69 deletions
-15
View File
@@ -38,9 +38,6 @@ vim.o.tabstop = 2 -- Show tab as this number of spaces
vim.o.virtualedit = 'block' -- Allow going past end of line in blockwise mode
vim.opt.autoread = true -- Do not prompt to reread files on update
-- Pattern for a start of numbered list (used in `gw`).
vim.o.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]]
-- Built-in completion
vim.o.complete = '.,w,b,kspell' -- Use less sources
vim.o.completeopt = 'menuone,noselect,fuzzy,nosort' -- Use custom behavior
@@ -71,16 +68,4 @@ Config.later(function()
},
update_in_insert = false,
})
local dap_signs = {
DapBreakpoint = { text = '', texthl = 'DapBreakpoint', linehl = '', numhl = '' },
DapBreakpointCondition = { text = '', texthl = 'DapBreakpointCondition', linehl = '', numhl = '' },
DapLogPoint = { text = '', texthl = 'DapLogPoint', linehl = '', numhl = '' },
DapStopped = { text = '', texthl = 'DapStopped', linehl = 'DapStoppedLine', numhl = '' },
DapBreakpointRejected = { text = '', texthl = 'DapBreakpointRejected', linehl = '', numhl = '' },
}
for name, sign in pairs(dap_signs) do
vim.fn.sign_define(name, sign)
end
end)
+11 -25
View File
@@ -14,32 +14,18 @@ Config.leader_group_clues = {
}
-- Helpers =====================================================================
local function lazy_wrap(name, action)
return function()
if Config["setup_" .. name] then Config["setup_" .. name]() end
action()
end
local function map(mode, lhs, rhs, desc, plugin)
local final_rhs = plugin and function()
if Config["setup_" .. plugin] then Config["setup_" .. plugin]() end
rhs()
end or rhs
vim.keymap.set(mode, lhs, final_rhs, { desc = desc })
end
local nmap = function(lhs, rhs, desc, plugin)
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
vim.keymap.set("n", lhs, final_rhs, { desc = desc })
end
local tmap = function(lhs, rhs, desc, plugin)
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
vim.keymap.set("t", lhs, final_rhs, { desc = desc })
end
local nmap_leader = function(suffix, rhs, desc, plugin)
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
vim.keymap.set("n", "<Leader>" .. suffix, final_rhs, { desc = desc })
end
local xmap_leader = function(suffix, rhs, desc, plugin)
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
vim.keymap.set("x", "<Leader>" .. suffix, final_rhs, { desc = desc })
end
local nmap = function(lhs, rhs, desc, plugin) map("n", lhs, rhs, desc, plugin) end
local tmap = function(lhs, rhs, desc, plugin) map("t", lhs, rhs, desc, plugin) end
local nmap_leader = function(suffix, rhs, desc, plugin) map("n", "<Leader>" .. suffix, rhs, desc, plugin) end
local xmap_leader = function(suffix, rhs, desc, plugin) map("x", "<Leader>" .. suffix, rhs, desc, plugin) end
-- Buffers =====================================================================
nmap_leader("bd", function() pcall(vim.cmd, "bdelete") end, "Delete")
@@ -122,7 +108,7 @@ nmap_leader("sw", function() MiniSessions.write() end, "Write current")
-- Terminal ====================================================================
nmap_leader("tT", function() vim.cmd("horizontal term") end, "Terminal (horizontal)")
nmap_leader("tt", function() vim.cmd("vertical term") end, "Terminal (vertical)")
nmap_leader("tc", function() vim.cmd("vertical term claude") end, "Terminal (vertical)")
nmap_leader("tc", function() vim.cmd("vertical term claude") end, "Claude")
nmap_leader("tg", function() require("terminal").open_terminal_app("lazygit") end, "LazyGit")
nmap_leader("ts", function() require("terminal").open_terminal_app("lazysql") end, "LazySQL")
+12 -5
View File
@@ -83,12 +83,19 @@ function Config.setup_dap()
Config.setup_dap = nil
vim.pack.add({ "https://github.com/mfussenegger/nvim-dap" })
local dap = require("dap")
dap.adapters.go = {
type = "server",
host = "127.0.0.1",
port = "${port}",
local dap_signs = {
DapBreakpoint = { text = '', texthl = 'DapBreakpoint' },
DapBreakpointCondition = { text = '', texthl = 'DapBreakpointCondition' },
DapLogPoint = { text = '', texthl = 'DapLogPoint' },
DapStopped = { text = '', texthl = 'DapStopped', linehl = 'DapStoppedLine' },
DapBreakpointRejected = { text = '', texthl = 'DapBreakpointRejected' },
}
for name, sign in pairs(dap_signs) do
vim.fn.sign_define(name, sign)
end
local dap = require("dap")
dap.adapters.go = { type = "server", host = "127.0.0.1", port = "${port}" }
end
-- Kulala ======================================================================