[picker.git_diff] preview truncate output from diff #2924
Replies: 5 comments 6 replies
|
Related: |
|
How do you expect to scroll the picker preview when it's displaying a terminal buffer in Normal mode? You're using an interactive terminal program to display hunks. Note Focus the preview ( Tip If you'd rather enter Terminal mode automatically whenever the preview gains focus, here's a workaround: vim.api.nvim_create_autocmd({ "BufEnter", "WinEnter" }, {
desc = "Automatically enter Terminal mode when focusing the snacks preview",
pattern = "term://*",
group = vim.api.nvim_create_augroup("preview_insert_term", {}),
callback = function()
vim.schedule(function()
for _, picker in ipairs(Snacks.picker.get()) do
if picker:current_win() == "preview" and vim.bo.buftype == "terminal" then
vim.cmd.startinsert()
end
end
end)
end,
})Configure scrolling: ---@module 'snacks'
return {
"folke/snacks.nvim",
---@type snacks.Config
opts = {
picker = {
sources = {
git_log_file = {
previewers = {
diff = {
-- NOTE: We assume `hunk pager` is used as the default git pager
style = "terminal",
},
},
actions = {
term_ins = function(picker)
local mode = vim.api.nvim_get_mode().mode
if vim.bo.buftype == "terminal" and mode ~= "t" then
vim.cmd.startinsert()
else
picker:action("focus_input")
end
end,
term_exit = function(picker)
local mode = vim.api.nvim_get_mode().mode
if vim.bo.buftype == "terminal" and mode == "t" then
vim.cmd.stopinsert()
vim.api.nvim_input("0")
else
picker:action("close")
end
end,
hunk_pager_scroll_down = function(picker)
local chan = vim.bo[picker.preview.win.buf].channel
if chan ~= 0 then
vim.api.nvim_chan_send(chan, "<C-f>")
end
end,
hunk_pager_scroll_up = function(picker)
local chan = vim.bo[picker.preview.win.buf].channel
if chan ~= 0 then
vim.api.nvim_chan_send(chan, "<C-b>")
end
end,
},
win = {
input = {
keys = {
["<C-f>"] = { "hunk_pager_scroll_down", mode = { "i", "n" } },
["<C-b>"] = { "hunk_pager_scroll_up", mode = { "i", "n" } },
},
},
preview = {
keys = {
["i"] = { "term_ins", mode = { "t", "n" } },
["<Esc>"] = { "term_exit", mode = { "t", "n" } },
},
},
},
},
},
},
},
} |
|
Your So you should compare the output of |
|
Sorry for the delay, guys! Maybe I phrased that wrong, but what I'd like to achieve is using I made this video to show you what's happening. 01.mp4As you can see, I don't have this issue with the Note <C-f> is my leader key on wezterm, because of that I need to press twice. System Details for Context |
The idea of running However, the problem to my issue was the parameter ❯ nvimpager -h
Usage: nvimpager [-acp] [--] [nvim options and files]
nvimpager -h
nvimpager -v
nvimpager provides a simple pager based on neovim.
Options:
-h this help
-v version output
-a enforce auto mode (default)
-c enforce cat mode
-p enforce pager modeChanging to Thank you for leading me to the right spot and attention to this issue. May I ask another question related to the preview? cmd = { "delta", "--width", math.floor(vim.api.nvim_win_get_width(vim.api.nvim_get_current_win()) * 0.9) }Is this the right/common way to solve it? |
Uh oh!
There was an error while loading. Please reload this page.
Hi to everyone!
I'm encountering an issue where using
<leader>gftruncates the preview, displaying only the currently visible lines on preview pane rather than the full diff content.If I use
style = "fancy", it works with no problem. However, this mode doesn't have aside-by-sideoption. So, I'm trying to usedeltaorhunkinstead.My
gitconfig:When I scroll down, nothing appears after line 179.

But on

lazygitorgit diffthere are more content:❯ git diff 26d0983 HEAD -- configs/home/.config/nvim/lua/plugins/snacks.lua | wc -l 172Any ideia?
All reactions