feat: which-key icons for plugins

This commit is contained in:
punkfairie 2024-12-01 17:10:02 -08:00
parent 46f5ab5a65
commit 7d4b907416
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
10 changed files with 219 additions and 86 deletions

13
nvim/lua/colors.lua Normal file
View file

@ -0,0 +1,13 @@
---@type {[string]:"azure" | "blue" | "cyan" | "green" | "grey" | "orange" | "purple" | "red" | "yellow"}
return {
buffers = 'cyan',
diagnostics = 'green',
surround = 'purple',
ui = 'green',
window = 'blue',
search = 'green',
git = 'orange',
notifications = 'orange',
sessions = 'azure',
explorer = 'yellow',
}

View file

@ -22,12 +22,12 @@ end
-- Resize windows -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Resize windows -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
for key, dir in pairs({ for key, dir in pairs({
Up = 'Increase', Up = 'increase',
Down = 'Decrease', Down = 'decrease',
Left = 'Decrease', Left = 'decrease',
Right = 'Increase', Right = 'increase',
}) do }) do
local sign = (dir == 'Increase') and '+' or '-' local sign = (dir == 'increase') and '+' or '-'
set( set(
{ 'n' }, { 'n' },
@ -44,8 +44,8 @@ for key, dir in pairs({
['[b'] = 'previous', ['[b'] = 'previous',
[']b'] = 'next', [']b'] = 'next',
}) do }) do
-- previous -> Prev -- previous -> prev
local prettyDir = (dir:gsub('^%l', string.upper)):sub(1, 4) local prettyDir = dir:sub(1, 4)
set( set(
{ 'n' }, { 'n' },
@ -55,21 +55,21 @@ for key, dir in pairs({
) )
end end
set({ 'n' }, '<LEADER>bD', '<CMD>bd<CR>', { desc = 'Delete buffer and window' }) set({ 'n' }, '<LEADER>bD', '<CMD>bd<CR>', { desc = 'delete buffer and window' })
-- Clear search & refresh -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Clear search & refresh -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set( set(
{ 'n', 'i' }, { 'n', 'i' },
'<ESC>', '<ESC>',
'<CMD>noh<CR><ESC>', '<CMD>noh<CR><ESC>',
{ desc = 'Escape and clear hlsearch' } { desc = 'escape and clear hlsearch' }
) )
set( set(
{ 'n' }, { 'n' },
'<LEADER>ur', '<LEADER>ur',
'<CMD>nohlsearch<BAR>diffupdate<BAR>normal! <C-l><CR>', '<CMD>nohlsearch<BAR>diffupdate<BAR>normal! <C-l><CR>',
{ desc = 'Redraw / clear hlsearch / diff update' } { desc = 'redraw / clear hlsearch / diff update' }
) )
-- Better n & N -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Better n & N -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@ -80,14 +80,14 @@ for _, mode in ipairs({ 'n', 'x', 'o' }) do
{ mode }, { mode },
'n', 'n',
f("'Nn'[v:searchforward]%s", zv), f("'Nn'[v:searchforward]%s", zv),
{ desc = 'Next search result', expr = true } { desc = 'next search result', expr = true }
) )
set( set(
{ mode }, { mode },
'N', 'N',
f("'nN'[v:searchforward]%s", zv), f("'nN'[v:searchforward]%s", zv),
{ desc = 'Previous search result', expr = true } { desc = 'previous search result', expr = true }
) )
end end
@ -102,34 +102,36 @@ set(
{ 'n' }, { 'n' },
'<LEADER>K', '<LEADER>K',
'<CMD>norm! K<CR>', '<CMD>norm! K<CR>',
{ desc = 'Search <KEYWORDPROG> for word' } { desc = 'search <KEYWORDPROG> for word' }
) )
-- Better indenting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Better indenting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
for _, char in ipairs({ '<', '>' }) do for _, char in ipairs({ '<', '>' }) do
set({ 'v' }, char, f('%sgv', char)) local desc = 'indent ' .. (char == '<' and 'left' or 'right')
set({ 'v' }, char, f('%sgv', char), { desc = desc })
end end
-- Commenting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Commenting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
for key, dir in pairs({ o = 'Below', O = 'Above' }) do for key, dir in pairs({ o = 'below', O = 'above' }) do
set( set(
{ 'n' }, { 'n' },
f('gc%s', key), f('gc%s', key),
f('%s<ESC>Vcx<ESC><CMD>normal gcc<CR>fxa<BS>', key), f('%s<ESC>Vcx<ESC><CMD>normal gcc<CR>fxa<BS>', key),
{ desc = f('Add comment %s', dir) } { desc = f('add comment %s', dir) }
) )
end end
-- New files -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- New files -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set({ 'n' }, '<LEADER>fn', '<CMD>enew<CR>', { desc = 'New file' }) set({ 'n' }, '<LEADER>fn', '<CMD>enew<CR>', { desc = 'new file' })
-- Locations/quickfixes -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Locations/quickfixes -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set({ 'n' }, '<LEADER>xl', '<CMD>lopen<CR>', { desc = 'Location list' }) set({ 'n' }, '<LEADER>xl', '<CMD>lopen<CR>', { desc = 'location list' })
set({ 'n' }, '<LEADER>xq', '<CMD>copen<CR>', { desc = 'Quickfix list' }) set({ 'n' }, '<LEADER>xq', '<CMD>copen<CR>', { desc = 'quickfix list' })
for key, dir in pairs({ ['['] = 'Previous', [']'] = 'Next' }) do for key, dir in pairs({ ['['] = 'previous', [']'] = 'next' }) do
-- Previous -> prev -- previous -> prev
local cmd = (dir:gsub('^%l', string.lower)):sub(1, 4) local cmd = dir:sub(1, 4)
set( set(
{ 'n' }, { 'n' },
@ -142,7 +144,7 @@ end
-- Diagnostics -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Diagnostics -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set({ 'n' }, '<LEADER>cd', function() set({ 'n' }, '<LEADER>cd', function()
vim.diagnostic.open_float() vim.diagnostic.open_float()
end, { desc = 'Line diagnostics' }) end, { desc = 'line diagnostics' })
local function goto_diagnostic(next, severity) local function goto_diagnostic(next, severity)
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
@ -153,48 +155,48 @@ local function goto_diagnostic(next, severity)
end end
for key, sev in pairs({ for key, sev in pairs({
d = { nil, 'Diagnostic' }, d = { nil, 'diagnostic' },
e = { 'ERROR', 'Error' }, e = { 'ERROR', 'error' },
w = { 'WARN', 'Warning' }, w = { 'WARN', 'warning' },
}) do }) do
set( set(
{ 'n' }, { 'n' },
f(']%s', key), f(']%s', key),
goto_diagnostic(true, sev[1]), goto_diagnostic(true, sev[1]),
{ desc = f('Next %s', sev[2]) } { desc = f('next %s', sev[2]) }
) )
set( set(
{ 'n' }, { 'n' },
f('[%s', key), f('[%s', key),
goto_diagnostic(false, sev[1]), goto_diagnostic(false, sev[1]),
{ desc = f('Previous %s', sev[2]) } { desc = f('previous %s', sev[2]) }
) )
end end
-- Quit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Quit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set({ 'n' }, '<LEADER>qq', '<CMD>qa<CR>', { desc = 'Quit all' }) set({ 'n' }, '<LEADER>qq', '<CMD>qa<CR>', { desc = 'quit all' })
-- Inspect -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Inspect -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set({ 'n' }, '<LEADER>ui', vim.show_pos, { desc = 'Inspect position' }) set({ 'n' }, '<LEADER>ui', vim.show_pos, { desc = 'inspect position' })
-- Window management -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Window management -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set({ 'n' }, '<LEADER>w', '<C-w>', { desc = 'Windows', remap = true }) set({ 'n' }, '<LEADER>w', '<C-w>', { desc = 'windows', remap = true })
set({ 'n' }, '<LEADER>-', '<C-w>s', { desc = 'Split below', remap = true }) set({ 'n' }, '<LEADER>-', '<C-w>s', { desc = 'split below', remap = true })
set({ 'n' }, '<LEADER>|', '<C-w>v', { desc = 'Split right', remap = true }) set({ 'n' }, '<LEADER>|', '<C-w>v', { desc = 'split right', remap = true })
set({ 'n' }, '<LEADER>wd', '<C-w>c', { desc = 'Delete window', remap = true }) set({ 'n' }, '<LEADER>wd', '<C-w>c', { desc = 'delete window', remap = true })
-- Tab management -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Tab management -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
for key, act in pairs({ for key, act in pairs({
l = 'Last', l = 'last',
o = 'Only', o = 'only',
f = 'First', f = 'first',
['<TAB>'] = 'New', ['<TAB>'] = 'new',
[']'] = 'Next', [']'] = 'next',
d = 'Close', d = 'close',
['['] = 'Previous', ['['] = 'previous',
}) do }) do
local desc = (act == 'Only') and 'Close other tabs' or f('%s tab', act) local desc = (act == 'only') and 'close other tabs' or f('%s tab', act)
set( set(
{ 'n' }, { 'n' },

View file

@ -19,4 +19,20 @@ function M.local_require(prefix)
end end
end end
---Generates a function that can be used to create which-key mappings.
---@param color string The color to use for the icon.
---@return function
function M.wkSpec(color)
---@param lhs string
---@param icon string
---@param opts? wk.Spec
return function(lhs, icon, opts)
return vim.tbl_deep_extend(
'force',
{ lhs, icon = { icon = icon, color = color } },
(opts or {})
)
end
end
return M return M

View file

@ -8,7 +8,7 @@ return {
require('flash').jump() require('flash').jump()
end, end,
mode = { 'n', 'x', 'o' }, mode = { 'n', 'x', 'o' },
desc = 'Flash', desc = 'flash',
}, },
{ {
'S', 'S',
@ -16,14 +16,15 @@ return {
require('flash').treesitter() require('flash').treesitter()
end, end,
mode = { 'n', 'x', 'o' }, mode = { 'n', 'x', 'o' },
desc = 'Flash (treesitter)', desc = 'flash (treesitter)',
}, },
{ {
'r', 'r',
function() function()
require('flash').remote() require('flash').remote()
end, end,
desc = 'Remote flash', mode = { 'o' },
desc = 'remote flash',
}, },
{ {
'R', 'R',
@ -31,17 +32,30 @@ return {
require('flash').treesitter_search() require('flash').treesitter_search()
end, end,
mode = { 'x', 'o' }, mode = { 'x', 'o' },
desc = 'Treesitter search', desc = 'treesitter search',
}, },
{ {
'<C-s>', '<C-s>',
function() function()
require('flash').toggle() require('flash').toggle()
end, end,
'Toggle flash search', mode = { 'c' },
desc = 'toggle flash search',
}, },
}, },
before = function()
require('lz.n').trigger_load('which-key.nvim')
end,
after = function() after = function()
require('flash').setup({}) require('flash').setup({})
local mkKey = MarleyVim.wkSpec(require('colors').search)
require('which-key').add({
mkKey('s', '', { mode = { 'n', 'x', 'o' } }),
mkKey('S', '', { mode = { 'n', 'x', 'o' } }),
mkKey('r', '', { mode = { 'o' } }),
mkKey('r', '󰊕', { mode = { 'x', 'o' } }),
mkKey('<C-s>', '󰥖', { mode = { 'c' } }),
})
end, end,
} }

View file

@ -16,7 +16,7 @@ return {
}) })
end, end,
mode = { 'n', 'v' }, mode = { 'n', 'v' },
desc = 'Search and replace', desc = 'search and replace',
}, },
}, },
after = function() after = function()

View file

@ -15,7 +15,7 @@ local function make_toggle_mapping(root, grouped)
dir = root and (MarleyVim.root()) or (vim.uv.cwd()), dir = root and (MarleyVim.root()) or (vim.uv.cwd()),
}) })
end, end,
desc = 'Explorer (' .. (root and 'root' or 'cwd') .. ')', desc = 'explorer (' .. (root and 'root' or 'cwd') .. ')',
} }
end end
@ -35,7 +35,7 @@ return {
toggle = true, toggle = true,
}) })
end, end,
desc = 'Git explorer', desc = 'git explorer',
}, },
{ {
'<LEADER>be', '<LEADER>be',
@ -45,11 +45,16 @@ return {
toggle = true, toggle = true,
}) })
end, end,
desc = 'Buffer explorer', desc = 'buffer explorer',
}, },
}, },
before = function() before = function()
require('lz.n').trigger_load({ 'plenary.nvim', 'mini.icons', 'nui.nvim' }) require('lz.n').trigger_load({
'plenary.nvim',
'mini.icons',
'nui.nvim',
'which-key.nvim',
})
end, end,
after = function() after = function()
local icons = require('icons') local icons = require('icons')
@ -122,5 +127,11 @@ return {
{ event = events.FILE_RENAMED, handler = on_move }, { event = events.FILE_RENAMED, handler = on_move },
}, },
}) })
local colors = require('colors')
require('which-key').add({
{ '<LEADER>ge', icon = { icon = '', color = colors.git } },
{ '<LEADER>be', icon = { icon = '', color = colors.buffer } },
})
end, end,
} }

View file

@ -21,6 +21,9 @@ return {
require('lz.n').trigger_load('mini.icons') require('lz.n').trigger_load('mini.icons')
end, end,
after = function() after = function()
local icons = require('icons')
local colors = require('colors')
require('which-key').setup({ require('which-key').setup({
preset = 'modern', preset = 'modern',
spec = { spec = {
@ -37,12 +40,12 @@ return {
{ {
'<LEADER>u', '<LEADER>u',
group = 'ui', group = 'ui',
icon = { icon = '󰙵 ', color = 'cyan' }, icon = { icon = '󰙵 ', color = colors.ui },
}, },
{ {
'<LEADER>x', '<LEADER>x',
group = 'diagnostics/quickfix', group = 'diagnostics/quickfix',
icon = { icon = '󱖫 ', color = 'green' }, icon = { icon = '󱖫 ', color = colors.diagnostics },
}, },
{ '[', group = 'previous' }, { '[', group = 'previous' },
{ ']', group = 'next' }, { ']', group = 'next' },
@ -50,7 +53,7 @@ return {
{ {
'gs', 'gs',
group = 'surround', group = 'surround',
icon = { icon = '󰅲', color = 'purple' }, icon = { icon = '󰅲', color = colors.surround },
}, },
{ 'z', group = 'fold' }, { 'z', group = 'fold' },
{ {
@ -67,12 +70,59 @@ return {
return require('which-key.extras').expand.win() return require('which-key.extras').expand.win()
end, end,
}, },
{ 'gx', desc = 'Open with system app' }, { 'gx', desc = 'open with system app' },
{ '<LEADER>ur', icon = { icon = '', color = colors.ui } },
{ '<LEADER>|', icon = { icon = '' } },
{ '<LEADER>-', icon = { icon = '' } },
},
{
mode = { 'n', 'i' },
hidden = true,
{ '<DOWN>' },
{ '<UP>' },
{ '<LEFT>' },
{ '<RIGHT>' },
},
{
mode = { 'n', 'x' },
hidden = true,
{ 'j' },
{ 'k' },
},
{
mode = { 'v' },
{ '<', icon = { icon = '󰉵' } },
{ '>', icon = { icon = '󰉶' } },
}, },
}, },
icons = { icons = {
rules = { rules = {
{ pattern = 'explorer', icon = '󰙅' }, { pattern = 'explorer', icon = '󰙅', color = colors.explorer },
{ pattern = 'lazygit', icon = '' },
{ pattern = 'comment', icon = '' },
{ pattern = 'buffer', color = colors.buffer },
{
pattern = 'notification',
icon = '󰈸',
color = colors.notifications,
},
{ pattern = 'message', icon = '󰈸', color = colors.notifications },
{ pattern = 'session', icon = '', color = colors.sessions },
{
pattern = 'diagnostic',
icon = icons.diagnostics.Info,
hl = 'DiagnosticInfo',
},
{
pattern = 'error',
icon = icons.diagnostics.Error,
hl = 'DiagnosticError',
},
{
pattern = ' warning',
icon = icons.diagnostics.Warning,
hl = 'DiagnosticWarn',
},
}, },
}, },
}) })

View file

@ -2,31 +2,35 @@ return {
'bufferline.nvim', 'bufferline.nvim',
event = 'DeferredUIEnter', event = 'DeferredUIEnter',
keys = { keys = {
{ '<LEADER>bp', '<CMD>BufferLineTogglePin<CR>', desc = 'Toggle pin' }, {
'<LEADER>bp',
'<CMD>BufferLineTogglePin<CR>',
desc = 'toggle buffer pin',
},
{ {
'<LEADER>bP', '<LEADER>bP',
'<CMD>BufferLineGroupClose ungrouped<CR>', '<CMD>BufferLineGroupClose ungrouped<CR>',
desc = 'Delete non-pinned buffers', desc = 'delete non-pinned buffers',
}, },
{ {
'<LEADER>br', '<LEADER>br',
'<CMD>BufferLineCloseRight<CR>', '<CMD>BufferLineCloseRight<CR>',
desc = 'Delete buffers to the right', desc = 'delete buffers to the right',
}, },
{ {
'<LEADER>bl', '<LEADER>bl',
'<CMD>BufferLineCloseLeft<CR>', '<CMD>BufferLineCloseLeft<CR>',
desc = 'Delete buffers to the left', desc = 'delete buffers to the left',
}, },
{ '<S-H>', '<CMD>BufferLineCyclePrev<CR>', desc = 'Previous buffer' }, { '<S-H>', '<CMD>BufferLineCyclePrev<CR>', desc = 'previous buffer' },
{ '<S-L>', '<CMD>BufferLineCycleNext<CR>', desc = 'Next buffer' }, { '<S-L>', '<CMD>BufferLineCycleNext<CR>', desc = 'next buffer' },
{ '[b', '<CMD>BufferLineCyclePrev<CR>', desc = 'Previous buffer' }, { '[b', '<CMD>BufferLineCyclePrev<CR>', desc = 'previous buffer' },
{ ']b', '<CMD>BufferLineCycleNext<CR>', desc = 'Next buffer' }, { ']b', '<CMD>BufferLineCycleNext<CR>', desc = 'next buffer' },
{ '[B', '<CMD>BufferLineMovePrev<CR>', desc = 'Move buffer left' }, { '[B', '<CMD>BufferLineMovePrev<CR>', desc = 'move buffer left' },
{ ']B', '<CMD>BufferLineMoveNext<CR>', desc = 'Move buffer right' }, { ']B', '<CMD>BufferLineMoveNext<CR>', desc = 'move buffer right' },
}, },
before = function() before = function()
require('lz.n').trigger_load('mini.icons') require('lz.n').trigger_load({ 'mini.icons', 'which-key.nvim' })
if vim.g.colors_name == 'rose-pine' then if vim.g.colors_name == 'rose-pine' then
require('lz.n').trigger_load('rose-pine') require('lz.n').trigger_load('rose-pine')
@ -85,5 +89,21 @@ return {
end) end)
end, end,
}) })
local colors = require('colors')
local mkKey = MarleyVim.wkSpec(colors.buffers)
require('which-key').add({
mkKey('<LEADER>bp', ''),
mkKey('<LEADER>bP', '󰐄'),
mkKey('<LEADER>br', ''),
mkKey('<LEADER>bl', ''),
mkKey('<S-H>', ''),
mkKey('<S-L>', ''),
mkKey('[b', ''),
mkKey(']b', ''),
mkKey('[B', ''),
mkKey(']B', ''),
})
end, end,
} }

View file

@ -2,49 +2,49 @@ return {
'noice.nvim', 'noice.nvim',
event = 'DeferredUIEnter', event = 'DeferredUIEnter',
keys = { keys = {
{ '<LEADER>nn', '', desc = '+notifications' }, { '<LEADER>n', '', desc = '+notifications' },
{ {
'<S-ENTER>', '<S-ENTER>',
function() function()
require('noice').redirect(vim.fn.getcmdline()) require('noice').redirect(vim.fn.getcmdline())
end, end,
mode = 'c', mode = 'c',
desc = 'Redirect cmdline', desc = 'redirect cmdline',
}, },
{ {
'<LEADER>nl', '<LEADER>nl',
function() function()
require('noice').cmd('last') require('noice').cmd('last')
end, end,
desc = 'Last message', desc = 'last message',
}, },
{ {
'<LEADER>nh', '<LEADER>nh',
function() function()
require('noice').cmd('history') require('noice').cmd('history')
end, end,
desc = 'Message history', desc = 'message history',
}, },
{ {
'<LEADER>na', '<LEADER>na',
function() function()
require('noice').cmd('all') require('noice').cmd('all')
end, end,
desc = 'All messages', desc = 'all messages',
}, },
{ {
'<LEADER>nd', '<LEADER>nd',
function() function()
require('noice').cmd('dismiss') require('noice').cmd('dismiss')
end, end,
desc = 'Dismiss all', desc = 'dismiss all',
}, },
{ {
'<LEADER>nt', '<LEADER>nt',
function() function()
require('noice').cmd('pick') require('noice').cmd('pick')
end, end,
desc = 'Message picker', desc = 'message picker',
}, },
{ {
'<C-f>', '<C-f>',
@ -56,7 +56,7 @@ return {
mode = { 'i', 'n', 's' }, mode = { 'i', 'n', 's' },
silent = true, silent = true,
expr = true, expr = true,
desc = 'Scroll forward', desc = 'scroll forward',
}, },
{ {
'<C-b>', '<C-b>',
@ -68,11 +68,11 @@ return {
mode = { 'i', 'n', 's' }, mode = { 'i', 'n', 's' },
silent = true, silent = true,
expr = true, expr = true,
desc = 'Scroll backward', desc = 'scroll backward',
}, },
}, },
before = function() before = function()
require('lz.n').trigger_load('nui.nvim') require('lz.n').trigger_load({ 'nui.nvim', 'which-key.nvim' })
end, end,
after = function() after = function()
require('noice').setup({ require('noice').setup({
@ -102,5 +102,12 @@ return {
lsp_doc_border = true, lsp_doc_border = true,
}, },
}) })
local mkKey = MarleyVim.wkSpec(require('colors').notifications)
require('which-key').add({
mkKey('<S-ENTER>', '', { mode = 'c' }),
mkKey('<C-f>', '', { mode = { 'i', 'n', 's' } }),
mkKey('<C-b>', '', { mode = { 'i', 'n', 's' } }),
})
end, end,
} }

View file

@ -26,16 +26,16 @@ vim.print = _G.dd
set({ 'n' }, '<LEADER>un', function() set({ 'n' }, '<LEADER>un', function()
Snacks.notifier.hide() Snacks.notifier.hide()
end, { desc = 'Dismiss all notifications' }) end, { desc = 'dismiss all notifications' })
-- Buffers -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Buffers -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set({ 'n' }, '<LEADER>bd', function() set({ 'n' }, '<LEADER>bd', function()
Snacks.bufdelete() Snacks.bufdelete()
end, { desc = 'Delete buffer' }) end, { desc = 'delete buffer' })
set({ 'n' }, '<LEADER>bo', function() set({ 'n' }, '<LEADER>bo', function()
Snacks.bufdelete.other() Snacks.bufdelete.other()
end, { desc = 'Delete other buffers' }) end, { desc = 'delete other buffers' })
-- Toggles -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Toggles -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@ -69,11 +69,11 @@ end
set({ 'n' }, '<LEADER>gb', function() set({ 'n' }, '<LEADER>gb', function()
Snacks.git.blame_line() Snacks.git.blame_line()
end, { desc = 'Git blame line' }) end, { desc = 'git blame line' })
set({ 'n' }, '<LEADER>gB', function() set({ 'n' }, '<LEADER>gB', function()
Snacks.gitbrowse() Snacks.gitbrowse()
end, { desc = 'Git browse (open)' }) end, { desc = 'git browse (open)' })
set({ 'n' }, '<LEADER>gY', function() set({ 'n' }, '<LEADER>gY', function()
Snacks.gitbrowse({ Snacks.gitbrowse({
@ -81,14 +81,14 @@ set({ 'n' }, '<LEADER>gY', function()
vim.fn.setreg('+', url) vim.fn.setreg('+', url)
end, end,
}) })
end, { desc = 'Git browse (copy)' }) end, { desc = 'git browse (copy)' })
-- LazyGit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- LazyGit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
if vim.fn.executable('lazygit') == 1 then if vim.fn.executable('lazygit') == 1 then
set({ 'n' }, '<LEADER>gg', function() set({ 'n' }, '<LEADER>gg', function()
Snacks.lazygit({ cwd = MarleyVim.root() }) Snacks.lazygit({ cwd = MarleyVim.root() })
end, { desc = 'Lazygit (root dir)' }) end, { desc = 'lazygit (root dir)' })
-- set({ 'n' }, '<LEADER>gG', function() -- set({ 'n' }, '<LEADER>gG', function()
-- Snacks.lazygit() -- Snacks.lazygit()
@ -96,7 +96,7 @@ if vim.fn.executable('lazygit') == 1 then
set({ 'n' }, '<LEADER>gf', function() set({ 'n' }, '<LEADER>gf', function()
Snacks.lazygit.log_file() Snacks.lazygit.log_file()
end, { desc = 'Lazygit current file history' }) end, { desc = 'lazygit current file history' })
set({ 'n' }, '<LEADER>gl', function() set({ 'n' }, '<LEADER>gl', function()
Snacks.lazygit.log({ cwd = MarleyVim.root() }) Snacks.lazygit.log({ cwd = MarleyVim.root() })