mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 08:55:16 -06:00
random cleanups
This commit is contained in:
parent
095e78128b
commit
27ce531531
9 changed files with 14 additions and 53 deletions
|
|
@ -7,7 +7,7 @@ M.setup = function()
|
|||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>fs', function()
|
||||
require('plugins.lib.session_jj').load()
|
||||
M.load()
|
||||
end, { noremap = true, desc = 'mini session select' })
|
||||
end
|
||||
|
||||
|
|
@ -50,7 +50,6 @@ M.load = function()
|
|||
if id == '' then
|
||||
return
|
||||
end
|
||||
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. id .. '.shada'
|
||||
if M.check_exists(id) then
|
||||
vim.ui.select({
|
||||
'Yes',
|
||||
|
|
@ -58,6 +57,7 @@ M.load = function()
|
|||
}, { prompt = 'Session found at ' .. id .. ', load it?' }, function(c)
|
||||
if c == 'Yes' then
|
||||
-- load session (buffers, etc) as well as shada (marks)
|
||||
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. id .. '.shada'
|
||||
MiniSessions.read(id)
|
||||
vim.notify('loaded jj session: ' .. id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ function M.status()
|
|||
local files = {}
|
||||
|
||||
for status in status_raw:gmatch('[^\r\n]+') do
|
||||
local state, text = string.match(status, '^(%a)%s(.+)$')
|
||||
|
||||
if state and text then
|
||||
local file = text
|
||||
local state, file = string.match(status, '^(%a)%s(.+)$')
|
||||
|
||||
if state and file then
|
||||
local hl = ''
|
||||
if state == 'A' then
|
||||
hl = 'SnacksPickerGitStatusAdded'
|
||||
|
|
@ -20,15 +18,13 @@ function M.status()
|
|||
hl = 'SnacksPickerGitStatusDeleted'
|
||||
elseif state == 'R' then
|
||||
hl = 'SnacksPickerGitStatusRenamed'
|
||||
file = string.match(text, '{.-=>%s*(.-)}')
|
||||
file = string.match(file, '{.-=>%s*(.-)}')
|
||||
end
|
||||
|
||||
local diff = vim.fn.system('jj diff ' .. file .. ' --ignore-working-copy --no-pager --stat --git')
|
||||
local diff = vim.fn.system('jj diff ' .. file .. ' --no-pager --stat --git')
|
||||
table.insert(files, {
|
||||
text = text,
|
||||
file = file,
|
||||
filename_hl = hl,
|
||||
state = state,
|
||||
diff = diff,
|
||||
})
|
||||
end
|
||||
|
|
@ -37,11 +33,9 @@ function M.status()
|
|||
return files
|
||||
end
|
||||
|
||||
local files = get_files()
|
||||
|
||||
Snacks.picker.pick {
|
||||
source = 'jj_status',
|
||||
items = files,
|
||||
items = get_files(),
|
||||
format = 'file',
|
||||
title = 'jj status',
|
||||
preview = function(ctx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue