Delta Preview Git Preview doesn't work
Hi there, this is my second issue I noticed after upgrading to 1.3.0. (My first is this one: #19)
I want to use delta for the Diff Preview, but I can't get it to work. It works in lazygit though. 🤔 I hope you can help me. :)
Screenshots
This is the Diff Preview when I am in prj:
This is the Diff Preview when I use the preview_cmd setting from your config (preview_cmd = "bat --force-colorization {} --line-range 0:1000" + git_pager = "delta"):
This is the Diff Preview when I am in lazygit:
Version
[I] ➜ brew info projectable
==> dzfrias/formulae/projectable: stable 1.3.0
Highly configurable TUI project manager
https://github.com/dzfrias/projectable
/opt/homebrew/Cellar/projectable/1.3.0 (7 files, 7.1MB) *
Built from source on 2023-07-03 at 09:08:58
From: https://github.com/dzfrias/homebrew-formulae/blob/HEAD/Formula/projectable.rb
==> Dependencies
Build: rust ✔
Config
# General settings
project_roots = [".git"]
esc_to_close = true
# Keys
up = ["k", "up"]
down = ["j", "down"]
quit = "q"
help = "?"
all_up = "g"
all_down = "G"
open = "enter"
# Kill processes started by projectable
kill_processes = "ctrl-c"
# Defaults to $EDITOR
editor_cmd = "nvim"
# General styles
selected = { color = "black", bg = "magenta" }
popup_border_style = { color = "white" }
help_key_style = { color = "lightcyan", mods = ["bold"] }
[special_commands]
# "<GLOB>" = ["<COMMAND>"] format
"package.json" = ["npm run dev"]
[commands]
ctrl-g = "!!lazygit"
ctrl-v = "tmux split-window -h nvim {}"
ctrl-x = "tmux split-window -v nvim {}"
[preview]
preview_cmd = "cat {}"
git_pager = "delta"
down_key = "ctrl-d"
up_key = "ctrl-u"
scroll_amount = 10
border_color = { color = "cyan" }
scroll_bar_color = { color = "magenta" }
# Unreached part of the scroll bar
unreached_bar_color = { color = "blue" }
[filetree]
# Whether to show git diffs
use_git = true
# Ignore certain elobs
ignore = []
use_gitignore = true
refresh_time = 1000
dirs_first = true
show_hidden_by_default = true
# Whether to show special commands in fuzzy matching view. The alternative is
# a list-style view
special_commands_fuzzy = true
# Keys
special_command = "v"
down_three = "ctrl-n"
up_three = "ctrl-p"
exec_cmd = ":"
delete = "d"
search = "/"
clear = '\'
new_file = "n"
new_dir = "N"
rename = "r"
move_path = "R"
git_filter = "T"
diff_mode = "t"
open_all = "o"
close_all = "O"
mark_selected = "m"
open_under = "l"
close_under = "h"
show_dotfiles = "."
focus = "f"
# Colors
dir_style = { color = "blue", mods = ["italic"] }
filtered_out_message = { color = "yellow" }
border_color = { color = "magenta" }
# Color of git added files
git_added_style = { color = "green" }
git_new_style = { color = "red" }
git_modified_style = { color = "blue" }
# Color of marked files
marks_style = { color = "yellow" }
[log]
border_color = { color = "blue" }
info = { color = "white" }
error = { color = "red" }
debug = { color = "green" }
# Only shown when run with the --debug option
warn = { color = "red" }
trace = { color = "magenta" }
[marks]
# Whether to show marks as relative paths or not
relative = true
open = "M"
delete = "d"
# Color of marks in marks window
mark_style = { color = "white" }
Hmmm... not sure what the issue could be here. I tried your config and it worked for me.
$SHELL "git diff {} | delta" is the command that's run when the preview mode is on. Can you try running that in your terminal and see if it works?
Hmmm... not sure what the issue could be here. I tried your config and it worked for me.
$SHELL "git diff {} | delta"is the command that's run when the preview mode is on. Can you try running that in your terminal and see if it works?
Hey, thank you for your reply. :)
I get this:
terra-core.nvim on main [$!]
[I] ➜ $SHELL "git diff {} | delta"
/bin/zsh: can't open input file: git diff {} | delta
Sorry for the drawn-out response. Can you try substituting {} with a file path that's been modified that git is tracking, and then seeing what the output is? I mostly just want to see if it works or not.
Maybe try putting this in your config, as well:
[preview]
git_pager = "delta --color-only"
Also, can I see your delta config?
Hi there. No worries, I was also on vacation, so I apologize for the late response. :)
I identified the issue. It was my fault; I was unaware that I had to press t to enable the Diff View. When I press t, the Diff Preview with Delta works. Is there a configuration option to automatically toggle the Diff Preview with Delta?