From d6276e80254ddb42bc7263b67a8b73e0f2e52999 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sat, 22 Jul 2017 17:43:39 -0500 Subject: [PATCH] [osx] Support custom keyword used by `mand` to open man pages in Dash.app `zstyle` based customization is now avaialble in *zpreztorc*. --- modules/osx/README.md | 13 +++++++++++++ modules/osx/functions/mand | 5 ++++- runcoms/zpreztorc | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/osx/README.md b/modules/osx/README.md index d8eff0f..870b486 100644 --- a/modules/osx/README.md +++ b/modules/osx/README.md @@ -3,6 +3,19 @@ OSX Defines [Mac OS X][1] aliases and functions. +Settings +-------- + +### Dash Keyword + +To change the keyword used by `mand` to open man pages in [_Dash.app_][2] from +its default value of 'manpages', add the following line in *zpreztorc* and +replace the **keyword** with the one configured in [_Dash.app_][2]. + +```sh +zstyle ':prezto:module:osx:man' dash-keyword 'keyword' +``` + Aliases ------- diff --git a/modules/osx/functions/mand b/modules/osx/functions/mand index 7a9653a..b8e958e 100644 --- a/modules/osx/functions/mand +++ b/modules/osx/functions/mand @@ -7,7 +7,8 @@ function mand { if (( $# > 0 )); then - open "dash://manpages:$1" 2>/dev/null + zstyle -s ':prezto:module:osx:man' dash-keyword 'dashkw' || dashkw='manpages' + open "dash://$dashkw:$1" 2>/dev/null if (( $? != 0 )); then print "$0: Dash is not installed" >&2 break @@ -15,6 +16,8 @@ function mand { else print 'What manual page do you want?' >&2 fi + + unset dashkw } mand "$@" diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 31368d1..22b5b3d 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -81,6 +81,13 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Set the search globbing flags. # zstyle ':prezto:module:history-substring-search' globbing-flags '' +# +# OS X +# + +# Set the keyword used by `mand` to open man pages in Dash.app +# zstyle ':prezto:module:osx:man' dash-keyword 'manpages' + # # Pacman #