zsh: Add fzf-tab manpage preview for commands
If a command has a manpage associated, we now display it in the fzf-preview box that fzf-tab completion shows.
This commit is contained in:
parent
4b720464ff
commit
b6e84bbc99
1 changed files with 4 additions and 1 deletions
|
|
@ -94,8 +94,11 @@ zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
|
|||
# show systemd unit status
|
||||
zstyle ':fzf-tab:complete:systemctl-*:*' fzf-preview 'SYSTEMD_COLORS=1 systemctl status $word'
|
||||
# env var contents
|
||||
zstyle ':fzf-tab:complete:(-command-|-parameter-|-brace-parameter-|export|unset|expand):*' \
|
||||
zstyle ':fzf-tab:complete:(-parameter-|-brace-parameter-|export|unset|expand):*' \
|
||||
fzf-preview 'echo ${(P)word}'
|
||||
# give MAN pages for cmds or show their expanded path
|
||||
zstyle ':fzf-tab:complete:-command-:*' fzf-preview \
|
||||
'(out=$(tldr --color always "$word") 2>/dev/null && echo $out) || (out=$(MANWIDTH=$FZF_PREVIEW_COLUMNS man "$word") 2>/dev/null && echo $out) || (out=$(which "$word") && echo $out) || echo "${(P)word}"'
|
||||
|
||||
# show hostname if we are in a distrobox environment
|
||||
if [ -n "$DISTROBOX_ENTER_PATH" ] && [ -f /run/.containerenv ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue