Compare commits
3
Commits
cc4945649b
...
67be12a30c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67be12a30c | ||
|
|
807374f997 | ||
|
|
79f874561a |
No files matched your search
+11
-9
@@ -20,16 +20,18 @@ return {
|
||||
|
||||
local items = {}
|
||||
for _, l in ipairs(lines) do
|
||||
local s = l:sub(1, 2):match('%S+')
|
||||
local p = l:sub(4):gsub('.* %-> ', ''):gsub('^"(.*)"$', '%1')
|
||||
local hl = l:sub(1, 1) ~= ' ' and l:sub(1, 1) ~= '?' and 'DiagnosticOk' or hls[s:sub(1, 1)]
|
||||
items[#items + 1] = {
|
||||
text = string.format(' %-2s %s', s == '??' and '?' or s, p),
|
||||
path = p,
|
||||
hl = hl,
|
||||
}
|
||||
-- Skip fully staged files (nothing left in the worktree column)
|
||||
if l:sub(2, 2) ~= ' ' then
|
||||
local s = l:sub(1, 2):match('%S+')
|
||||
local p = l:sub(4):gsub('.* %-> ', ''):gsub('^"(.*)"$', '%1')
|
||||
items[#items + 1] = {
|
||||
text = string.format(' %-2s %s', s == '??' and '?' or s, p),
|
||||
path = p,
|
||||
hl = hls[l:sub(2, 2)],
|
||||
}
|
||||
end
|
||||
end
|
||||
if #items == 0 then return vim.notify('No changes', vim.log.levels.INFO) end
|
||||
if #items == 0 then return vim.notify('No unstaged changes', vim.log.levels.INFO) end
|
||||
|
||||
MiniPick.start({ source = { items = items, name = 'Git Status', show = show } })
|
||||
end,
|
||||
|
||||
@@ -4,13 +4,11 @@ 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', keys = '<Leader>g', desc = '+Git' },
|
||||
{ mode = 'n', keys = '<Leader>l', desc = '+Language' },
|
||||
{ mode = { 'n', 'x' }, keys = '<Leader>g', desc = '+Git' },
|
||||
{ mode = { 'n', 'x' }, keys = '<Leader>l', desc = '+Language' },
|
||||
{ mode = 'n', keys = '<Leader>r', desc = '+Request' },
|
||||
{ mode = 'n', keys = '<Leader>t', desc = '+Terminal' },
|
||||
{ mode = 'n', keys = '<Leader><Tab>', desc = '+Tab' },
|
||||
{ mode = 'x', keys = '<Leader>g', desc = '+Git' },
|
||||
{ mode = 'x', keys = '<Leader>l', desc = '+Language' },
|
||||
}
|
||||
|
||||
-- Keymap Helpers
|
||||
@@ -84,13 +82,11 @@ end
|
||||
|
||||
leader('ga', function() vim.cmd('Git add %') end, 'Add current file')
|
||||
leader('gd', diff_unstaged, 'Diff unstaged')
|
||||
leader('gs', function() MiniGit.show_at_cursor() end, 'Show at cursor')
|
||||
leader('gs', function() MiniGit.show_at_cursor() end, 'Show at selection', 'x')
|
||||
leader('gs', function() MiniGit.show_at_cursor() end, 'Show at cursor', { 'n', 'x' })
|
||||
|
||||
-- Language
|
||||
leader('la', function() vim.lsp.buf.code_action() end, 'Actions')
|
||||
leader('lf', function() require('conform').format({ async = true }) end, 'Format')
|
||||
leader('lf', function() require('conform').format({ async = true }) end, 'Format selection', 'x')
|
||||
leader('lf', function() require('conform').format({ async = true }) end, 'Format', { 'n', 'x' })
|
||||
leader('li', function() vim.lsp.buf.implementation() end, 'Implementation')
|
||||
leader('ll', function() vim.lsp.codelens.run() end, 'Lens')
|
||||
leader('lr', function() vim.lsp.buf.rename() end, 'Rename')
|
||||
|
||||
+6
-19
@@ -9,20 +9,11 @@ Config.now(function()
|
||||
starter.setup({
|
||||
items = {
|
||||
function()
|
||||
return vim.iter({ vim.fn.glob('~/Code/*', 0, 1), vim.fn.glob('~/Documents/*/*', 0, 1) })
|
||||
:flatten()
|
||||
:filter(function(p) return vim.fn.isdirectory(p) == 1 end)
|
||||
:map(function(p)
|
||||
return {
|
||||
name = vim.fn.fnamemodify(p, ':t'),
|
||||
action = function()
|
||||
vim.fn.chdir(p)
|
||||
require('mini.files').open(p)
|
||||
end,
|
||||
section = 'Projects',
|
||||
}
|
||||
end)
|
||||
:totable()
|
||||
local dirs = vim.list_extend(vim.fn.glob('~/Code/*', 0, 1), vim.fn.glob('~/Documents/*/*', 0, 1))
|
||||
return vim.iter(dirs):filter(function(p) return vim.fn.isdirectory(p) == 1 end):map(function(p)
|
||||
local open = function() vim.fn.chdir(p) require('mini.files').open(p) end
|
||||
return { name = vim.fn.fnamemodify(p, ':t'), action = open, section = 'Projects' }
|
||||
end):totable()
|
||||
end,
|
||||
|
||||
starter.sections.builtin_actions(),
|
||||
@@ -72,16 +63,12 @@ Config.later(function()
|
||||
require('mini.extra').setup()
|
||||
end)
|
||||
|
||||
-- File Explorer
|
||||
-- File Explorer & auto root
|
||||
Config.now_if_args(function()
|
||||
require('mini.files').setup()
|
||||
Config.autocmd('User', 'MiniFilesExplorerOpen', function()
|
||||
MiniFiles.set_bookmark('c', vim.fn.stdpath('config'), { desc = 'Config' })
|
||||
MiniFiles.set_bookmark('w', vim.fn.getcwd, { desc = 'Working directory' })
|
||||
end, 'Add default marks')
|
||||
end)
|
||||
|
||||
-- Utilities
|
||||
Config.now_if_args(function()
|
||||
require('mini.misc').setup_auto_root()
|
||||
end)
|
||||
Reference in new issue
Block a user