I’m playing around with fzf and fzf-tab in zsh and have attempted to set up the following zstyle command.
zstyle ':fzf-tab:complete:bat:*' fzf-preview '[[ -d "$realpath" ]] && ls --color "$realpath" || bat --style=numbers --color=always "$realpath"'
This works fine and shows a preview of the file in $realpath
using bat. However, I was wondering if there is a way to increase the height of the preview windown when running bat
with fzf
.
For example when running bat
within one of my projects, the number of lines in the preview window is equal to the number of files with in the directory. However I would like the number of the lines to be at a minimum of 10.
For reference: Fig.1. In this example the file Main.java
is 17 lines long however the window shows only first 3 lines, despite the window being ‘scrollable’ I was wondering if there is a way to configure the preview window to show more of the file.
I am using zsh
in iTerm2 on MacOS and using the zinit plugin manager.
I have tried so far using the following EXPORT
command
export FZF_DEFAULT_OPTS="--preview-window=down:wrap:10"
However, this resulted in the preview window being on top of the search and the preview window line count being only 1.
I have found that this zstyle command shows the window dimensions
zstyle ':fzf-tab:complete:bat:*' fzf-preview 'echo Window size: $FZF_PREVIEW_LINES x $FZF_PREVIEW_COLUMNS'
However, an attempt to manipulate $FZF_PREVIEW_LINES
proved unsuccessful.
mxcury is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.