Skip to content

Commit

Permalink
[osx] Support custom keyword used by mand to open man pages in Dash…
Browse files Browse the repository at this point in the history
….app

`zstyle` based customization is now avaialble in *zpreztorc*.
  • Loading branch information
indrajitr authored and boomuuh committed Aug 9, 2017
1 parent d7f0827 commit ff1538e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
13 changes: 13 additions & 0 deletions modules/osx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------

Expand Down
5 changes: 4 additions & 1 deletion modules/osx/functions/mand
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@

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
fi
else
print 'What manual page do you want?' >&2
fi

unset dashkw
}

mand "$@"
7 changes: 7 additions & 0 deletions runcoms/zpreztorc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ zstyle ':prezto:module:editor' key-bindings 'vi'
# 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
#
Expand Down

0 comments on commit ff1538e

Please sign in to comment.