Replies: 1 comment
-
Okay on further investigation it turns out this is a problem with # Need to use sh for the preview because zsh doesn't let you override COLUMNS:
# https://github.com/junegunn/fzf/issues/1314
# Use heredoc to avoid quoting hell:
preview_command=$(cat <<'EOF'
COLUMNS="$FZF_PREVIEW_COLUMNS" LINES="$FZF_PREVIEW_LINES" sh -c 'pacman -Si {}'
EOF
)
sudo pacman -S $(pacman -Slq | fzf --exact --multi --height '~90%' --layout 'reverse' --preview="$preview_command") But it works: Is this the recommended way? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Trying to use fzf with pacman, the Arch package manager. Idea is to have the list of packages on the left, and preview window on the right. Preview window shows more information about the package. Selecting packages installs them. The basic functionality works but the wrapping is wrong in the preview window.
The command I'm using is:
sudo pacman -S $(pacman -Slq | fzf --exact --multi --height '~90%' --layout 'reverse' --preview='pacman -Si {}')
This is how it renders:
As you can see, the information is getting cut off. When I try adding the option
--preview-window='wrap'
, the text gets wrapped but incorrectly:You can see the problem with the "depends on" list, they're getting wrapped and indented wrong. It seems the
pacman -Si
command is doing its own wrapping. When I manually resize the terminal window to have the same width as the preview window, that command formats it in the right way:I presume it's querying the terminal width to know where to put the linebreaks. Is there some environmental variable I can set to make it use the number of columns in the preview window? I'm aware of the
FZF_PREVIEW_COLUMNS
variable but I don't know what to do with it.Beta Was this translation helpful? Give feedback.
All reactions