Files
nvim-modular/lua/custom/keymaps/toggles.lua
2025-08-29 23:21:21 +02:00

37 lines
1.1 KiB
Lua

-- toggles group mappings
--
local wk = require 'which-key'
local gitsigns = require 'gitsigns'
local function toggle_light_dark_theme()
if vim.o.background == 'light' then
vim.o.background = 'dark'
else
vim.o.background = 'light'
end
end
local function toggle_conceal()
local lvl = vim.o.conceallevel
if lvl > DefaultConcealLevel then
vim.o.conceallevel = DefaultConcealLevel
else
vim.o.conceallevel = FullConcealLevel
end
end
wk.add {
mode = { 'n' },
-- gitsigns
{ '<leader>tb', gitsigns.toggle_current_line_blame, desc = 'toggle git show [b]lame line' },
{ '<leader>td', gitsigns.preview_hunk_inline, desc = 'toggle git show [d]eleted' },
{ '<leader>tm', '<CMD>RenderMarkdown buf_toggle<CR>', desc = 'toggle [m]arkdown rendering for current' },
{ '<leader>tt', toggle_light_dark_theme, desc = 'toggle light/dark [t]heme' },
{ '<leader>tc', toggle_conceal, desc = 'toggle [c]onceal' },
{ '<leader>tz', ':setlocal spell!<cr>', desc = 'toggle [z]pellcheck' },
}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et