7 ms·
Tell HN: On macOS, `man-preview` opens man pages in Preview
Basically the title. I'm ok with man pages; can navigate using typical Vim keybindings. But sometimes it's nice to see them as a PDF where you can quickly find the information you're looking for.
I thought maybe others will find it useful too.
- protocontrol 4y ago> type man-preview man-preview not found
- bombcar 4y agoIt tries to do something for me but fails, on Ventura. Seems to just be a short script: which man-preview man-preview () { man -w "$@" &> /dev/null && man -t "$@" | open -f -a Preview || man "$@" }
- heckman 4y agoIt looks like it's trying to pipe PostScript to Preview, which as of Ventura, no longer supports PostScript.
- heckman 4y agoI've just now fixed it by passing the PostScript through ghostscript's ps2pdf: man-preview () { man -w "$@" &> /dev/null && man -t "$@" | ps2pdf - - | open -f -a Preview || man "$@" }
- themodelplumber 4y agoSince the topic of readable man pages has come up: I would love it if there was a utility to rearrange man pages in roughly back-to-front order. For example, this heading order is generally my preferred one: Author, See Also, Example / Uses, Description, (and I typically find that I already know the Name but it's OK to add that at the end :-)) This comes from some personal preference, but is also informed by my professional work in coaching tech professionals. In studying personality differences in tech, and listening to others' experiences in learning about tech, I developed a theory that a huge number of us get stuck attempting to read tech materials which were written by/from a completely opposite perspective (compared to our personal style) on why one reads, and what makes things readable. This is like being nearsighted and borrowing a farsighted person's glasses, expecting them to work because glasses are what you wear to fix your eyesight. In documentation, these two styles tend to draw battle lines around what you could call the man-forward or man-backward learning styles, IMO ;-) `tldr` is one example of a countering man-backward app-psychology that is available and a fix for some of us, in some ways. But until the day of reconciliation arrives, I will continue to periodically leap forward and scroll backward...
- heckman 4y agoPerhaps you are referring to the function provided by the ohmyzsh macos plugin?
- andrewmcwatters 4y agohttps://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos
- jasonjmcghee 4y agoHave you ever tried piping `man` to `bat`? Pretty great highlighting - you can export the command to MANPAGER: https://github.com/sharkdp/bat#man https://github.com/sharkdp/bat#man
- haeberli 4y agoWhich MacOS version? Monterey 12.6.1 doesn't want to play ...
- crazygringo 4y agoNot on Ventura 13.0 either.
- warning26 4y agoIt was noted in another comment, but this is actually a function of the "macos" plugin for Oh My Zsh, and not a built-in thing.
- girishso 4y agoI have a function in my .zshrc, copied from the internets ``` manps () { if [ -z "$1" ] then echo usage: $FUNCNAME topic echo This will open a PostScript formatted version of the man page for \'topic\'. else man -t $1 | open -f -a /System/Applications/Preview.app fi } ```
- pjmlp 4y agoPoor forgotten xman.
- tobylane 4y agoI have the following in my .bash_profile for this purpose. pman() { man -t $@ | open -fa Preview.app; }
- yesenadam 4y agoThank you! That's awesome, so much nicer to read than in the terminal. 'man-preview' seems zsh only.
- perfopt 4y ago~ % which man-preview man-preview not found
- leeches 4y agoIf you select a command and press 'Control+Command+?' it will open the man page in a new window. You can also customize the theme by editing the 'Man Page' profile in the settings.