Skip to content

Instantly share code, notes, and snippets.

@sirhc
Created June 21, 2013 17:35
Show Gist options
  • Save sirhc/5832879 to your computer and use it in GitHub Desktop.
Save sirhc/5832879 to your computer and use it in GitHub Desktop.
Try a bunch of perldoc commands to find documentation, finally failing over to man.
#!/bin/bash
#
# Vim configuration for pd (~/.vim/after/ftplugin/perl.vim):
# :setlocal keywordprg=pd
# :setlocal iskeyword+=:,$,@,%
pd=$(type -P cpandoc)
pd=${pd:-"$(type -P perldoc)"}
$pd -f "$@" 2>/dev/null && exit
$pd "$@" 2>/dev/null && exit
$pd -q "$@" 2>/dev/null && exit
man "$@" 2>/dev/null && exit
echo "$0: $@: No match" 1>&2
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment