Created
June 3, 2025 22:40
-
-
Save boneskull/9c1944eab0d3a3d0d476f2e783507390 to your computer and use it in GitHub Desktop.
Revisions
-
boneskull created this gist
Jun 3, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ This is a snippet for `zsh` you can add to a `.zshrc` to automatically open manpages in [Dash](https://kapeli.com/dash) if and only if the "Manpages" DocSet is installed. It's been tested with macOS Sequoia (v15.5). It uses the `omz_urlencode` function provided by [oh-my-zsh](https://ohmyz.sh). If you don't have `oh-my-zsh` installed, you can paste this into your `.zshrc` as a reasonable substitution: ```sh omz_urlencode() { local string="${@}" local strlen=${#string} local encoded="" for (( pos = 0; pos < strlen; pos ++ )); do c=${string:$pos:1} case "$c" in [-_.~a-zA-Z0-9]) o="${c}" ;; *) printf -v o '%%%02x' "'$c" esac encoded+="${o}" done echo "${encoded}" } ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ [[ -n $(mdfind "kMDItemFSName == 'Dash.app'" | head -n1) && -d "$HOME/Library/Application Support/Dash/DocSets/Man_Pages" ]] && { dash_man() { /usr/bin/open "dash://?query=manpages:$(omz_urlencode ${@})" } alias man=dash_man }