mxcury
mxcury

Reputation: 1

Is there a way to increase the size of fzf-preview window length?

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.

Upvotes: 0

Views: 532

Answers (1)

ayumo
ayumo

Reputation: 1

Height customization is mentioned here: https://github.com/junegunn/fzf?tab=readme-ov-file#preview-window and they also mentioned to not export those variables (what exactly I didn't bother understanding) but I don’t know how you can implement it

Upvotes: 0

Related Questions