Skip to content

Instantly share code, notes, and snippets.

@ideabucket
Created April 29, 2022 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideabucket/63066d465ad2cbeb32e6da0c4dd298cb to your computer and use it in GitHub Desktop.
Save ideabucket/63066d465ad2cbeb32e6da0c4dd298cb to your computer and use it in GitHub Desktop.
Small fish script you can set as $MANPAGER to view manpages in bbedit
#!/usr/bin/env fish
# derived from Dr Drang's bman: https://leancrew.com/all-this/2022/03/last-man-standing/
# set this as your $MANPAGER to have manpages automatically open in bbedit
# col -bx to strip the formatting, read -z to make it all one string rather than an array
col -bx | read -z manbuffer
# lets us set a man-esque window title, e.g. "awk(1)"
set manname (string lower (string match -r '^[^)]+\)' $manbuffer))
# this feels painfully non-idiomatic
echo $manbuffer | bbedit --new-window --clean --view-top -m "unix-man-page" -t $manname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment