Add capability to browse man pages in Dash.app

This commit is contained in:
Sorin Ionescu 2013-05-21 13:46:42 -04:00
parent 232313e2a0
commit 00e12b7a98
3 changed files with 25 additions and 3 deletions

View file

@ -15,6 +15,7 @@ Aliases
Functions Functions
--------- ---------
- `mand` opens _man_ pages in [_Dash.app_][2].
- `manp` opens _man_ pages in _Preview.app_. - `manp` opens _man_ pages in _Preview.app_.
- `pfd` prints the current _Finder_ directory. - `pfd` prints the current _Finder_ directory.
- `pfs` prints the current _Finder_ selection. - `pfs` prints the current _Finder_ selection.
@ -28,6 +29,6 @@ Authors
- [Sorin Ionescu](https://github.com/sorin-ionescu) - [Sorin Ionescu](https://github.com/sorin-ionescu)
[1]: http://www.apple.com/macosx/ [1]: http://www.apple.com/macosx/
[2]: http://kapeli.com/dash
[3]: http://www.iterm2.com/ [3]: http://www.iterm2.com/
[4]: https://github.com/sorin-ionescu/prezto/issues [4]: https://github.com/sorin-ionescu/prezto/issues

View file

@ -1,8 +1,8 @@
#compdef manp #compdef mand manp
#autoload #autoload
# #
# Completes manp. # Completes mand and manp.
# #
# Authors: # Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>

View file

@ -0,0 +1,21 @@
#
# Opens man pages in Dash.app.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
function mand {
if (( $# > 0 )); then
open "dash://manpages:$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
}
mand "$@"