zsh:glog: Position preview depending on dimensions
This commit is contained in:
@@ -69,10 +69,17 @@ local -a fzf_args=(
|
|||||||
# Do not sort when typing to maintain the sorting by date.
|
# Do not sort when typing to maintain the sorting by date.
|
||||||
"--no-sort"
|
"--no-sort"
|
||||||
)
|
)
|
||||||
# Hide preview window by default when the terminal is too small.
|
|
||||||
# 154 columns so that the commit subject on the left and the body lines on the
|
# The preview-window should be placed differently depending on the dimensions of
|
||||||
# right all fit. The preview can always be shown using the keybind from above.
|
# the terminal.
|
||||||
[[ "$(tput cols)" -ge 154 ]] || fzf_args+=(--preview-window hidden)
|
# 0.45 seems to be round about the ratio between cols and lines on my system.
|
||||||
|
# With that I get somewhat decent results with. This probably depends on the
|
||||||
|
# font and font-size of the terminal and needs to be changed potentially.
|
||||||
|
if (( $(tput cols) * 0.4 > $(tput lines) )); then
|
||||||
|
fzf_args+=(--preview-window=right)
|
||||||
|
else
|
||||||
|
fzf_args+=(--preview-window=down)
|
||||||
|
fi
|
||||||
|
|
||||||
# Display an ascii graph of the commits in the above format and pipe that into
|
# Display an ascii graph of the commits in the above format and pipe that into
|
||||||
# fzf.
|
# fzf.
|
||||||
|
|||||||
Reference in New Issue
Block a user