Zsh: Add cat-highlight function
This commit is contained in:
parent
bf5f9bad52
commit
224b12ffa6
@ -78,6 +78,8 @@ alias ip='ip -color -brief'
|
||||
# Add --accept=".jpg,.png" or whatever.
|
||||
alias wget_leech='wget --no-directories --page-requisites --span-hosts'
|
||||
|
||||
alias cat='cat-highlight'
|
||||
|
||||
# OS specific settings.
|
||||
case $(lsb_release -i -s 2> /dev/null) in
|
||||
Gentoo)
|
||||
|
@ -27,3 +27,15 @@ function export-emacs
|
||||
emacsclient -e "(setenv \"${name}\" \"${value}\")" >/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
# Highlight cat output with whatever less is using for highlighting
|
||||
function cat-highlight()
|
||||
{
|
||||
if [[ -t 1 ]]; then # We're in a terminal
|
||||
CATOPEN="${LESSOPEN/| }"
|
||||
CATOPEN="${CATOPEN/ %s}"
|
||||
cat $@ | eval ${CATOPEN}
|
||||
else
|
||||
cat $@
|
||||
fi
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user