mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-15 14:53:47 -05:00
Fix fzf-man-widget showing only the first section from man pages with multiple sections
@@ -2213,9 +2213,10 @@ Same functionality as above
|
||||
```sh
|
||||
|
||||
fzf-man-widget() {
|
||||
batman="man {1} | col -bx | bat --language=man --plain --color always --theme=\"Monokai Extended\""
|
||||
manpage="echo {} | sed 's/\([[:alnum:][:punct:]]*\) (\([[:alnum:]]*\)).*/\2 \1/'"
|
||||
batman="${manpage} | xargs -r man | col -bx | bat --language=man --plain --color always --theme=\"Monokai Extended\""
|
||||
man -k . | sort \
|
||||
| awk -v cyan=$(tput setaf 6) -v blue=$(tput setaf 4) -v res=$(tput sgr0) -v bld=$(tput bold) '{ $1=cyan bld $1; $2=res blue;} 1' \
|
||||
| awk -v cyan=$(tput setaf 6) -v blue=$(tput setaf 4) -v res=$(tput sgr0) -v bld=$(tput bold) '{ $1=cyan bld $1; $2=res blue $2; } 1' \
|
||||
| fzf \
|
||||
-q "$1" \
|
||||
--ansi \
|
||||
@@ -2223,7 +2224,7 @@ fzf-man-widget() {
|
||||
--prompt=' Man > ' \
|
||||
--preview-window '50%,rounded,<50(up,85%,border-bottom)' \
|
||||
--preview "${batman}" \
|
||||
--bind "enter:execute(man {1})" \
|
||||
--bind "enter:execute(${manpage} | xargs -r man)" \
|
||||
--bind "alt-c:+change-preview(cht.sh {1})+change-prompt(ﯽ Cheat > )" \
|
||||
--bind "alt-m:+change-preview(${batman})+change-prompt( Man > )" \
|
||||
--bind "alt-t:+change-preview(tldr --color=always {1})+change-prompt(ﳁ TLDR > )"
|
||||
|
||||
Reference in New Issue
Block a user