56 lines
2.8 KiB
Lua
56 lines
2.8 KiB
Lua
-- Clues
|
|
Config.leader_group_clues = {
|
|
{ mode = 'n', keys = '<Leader>d', desc = '+Debug' },
|
|
{ mode = 'n', keys = '<Leader>e', desc = '+Explore' },
|
|
{ mode = 'n', keys = '<Leader>f', desc = '+Find' },
|
|
{ mode = { 'n', 'x' }, keys = '<Leader>g', desc = '+Git' },
|
|
}
|
|
|
|
-- Keymap Helpers
|
|
local leader = function(suffix, rhs, desc, mode)
|
|
vim.keymap.set(mode or 'n', '<Leader>' .. suffix, rhs, { desc = desc, silent = true })
|
|
end
|
|
|
|
-- Debug
|
|
leader('db', function() require('dap').toggle_breakpoint() end, 'Toggle Breakpoint')
|
|
leader('dc', function() require('dap').continue() end, 'Run/Continue')
|
|
leader('dC', function() require('dap').run_to_cursor() end, 'Run to Cursor')
|
|
leader('di', function() require('dap.ui.widgets').hover() end, 'Inspect')
|
|
leader('dt', function() require('dap').terminate() end, 'Terminate')
|
|
|
|
-- Explore
|
|
local explore_at_file = function()
|
|
local file = vim.api.nvim_buf_get_name(0)
|
|
MiniFiles.open(vim.uv.fs_stat(file) and file or nil)
|
|
end
|
|
|
|
local yank_path = function(modifier)
|
|
return function() vim.fn.setreg('+', vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), modifier)) end
|
|
end
|
|
|
|
leader('ef', explore_at_file, 'File directory')
|
|
leader('ey', yank_path(':.'), 'Yank relative path')
|
|
leader('eY', yank_path(':p'), 'Yank absolute path')
|
|
|
|
-- Find
|
|
leader('fb', function() MiniPick.builtin.buffers() end, 'Buffers')
|
|
leader('fc', function() MiniExtra.pickers.git_commits() end, 'Commits (all)')
|
|
leader('fC', function() MiniExtra.pickers.git_commits({ path = vim.fn.expand('%') }) end, 'Commits (buf)')
|
|
leader('fd', function() MiniExtra.pickers.diagnostic({ scope = 'all' }) end, 'Diagnostic workspace')
|
|
leader('fD', function() MiniExtra.pickers.diagnostic({ scope = 'current' }) end, 'Diagnostic buffer')
|
|
leader('ff', function() MiniPick.builtin.files() end, 'Files')
|
|
leader('fg', function() MiniPick.builtin.grep_live() end, 'Grep live')
|
|
leader('fG', function() MiniPick.builtin.grep({ pattern = vim.fn.expand('<cword>') }) end, 'Grep word')
|
|
leader('fl', function() MiniExtra.pickers.buf_lines({ scope = 'all' }) end, 'Lines (all)')
|
|
leader('fL', function() MiniExtra.pickers.buf_lines({ scope = 'current' }) end, 'Lines (buf)')
|
|
leader('fm', function() require('git').status() end, 'Modified / changed files')
|
|
leader('fo', function() MiniExtra.pickers.oldfiles() end, 'Old / recent files')
|
|
leader('fr', function() MiniPick.builtin.resume() end, 'Resume')
|
|
leader('fs', function() MiniExtra.pickers.lsp({ scope = 'workspace_symbol_live' }) end, 'Symbols workspace')
|
|
leader('fS', function() MiniExtra.pickers.lsp({ scope = 'document_symbol' }) end, 'Symbols document')
|
|
leader('f:', function() MiniExtra.pickers.history({ scope = ':' }) end, 'Command history')
|
|
|
|
-- Git
|
|
leader('gd', function() require('git').diff() end, 'Diff unstaged')
|
|
leader('gs', function() MiniGit.show_at_cursor() end, 'Show at cursor', { 'n', 'x' })
|