mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 03:21:30 +01:00
zsh: functions: add mangrep
This commit is contained in:
parent
3b6cf2b92f
commit
a8c89d32c9
|
@ -266,3 +266,21 @@ make_backup() {
|
||||||
function find_by_mtime() {
|
function find_by_mtime() {
|
||||||
find $@ -printf "%T+ %p\n" | sort
|
find $@ -printf "%T+ %p\n" | sort
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function mangrep() {
|
||||||
|
set -x
|
||||||
|
if [[ -z "$@" ]]; then
|
||||||
|
echo "Usage: $0 <pattern> <command>"
|
||||||
|
echo "Opens man page for <command> at the first match for <pattern>"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
pattern=$1
|
||||||
|
cmd=$2
|
||||||
|
if [[ -z "$cmd" ]]; then
|
||||||
|
man "$cmd"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
MANPAGER="less -p \"$pattern\"" man "$cmd"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user