add highlight from brew and hl command
hl command accepts syntax type and optionally a filename as arguments. If a filename is given, it will syntax highlight the file and place the contents on the clipboard. If no file is given, it will use the contents of the clipboard.
This commit is contained in:
1
Brewfile
1
Brewfile
@@ -16,6 +16,7 @@ install macvim --override-system-vim
|
||||
install reattach-to-user-namespace
|
||||
install tmux
|
||||
install zsh
|
||||
install highlight
|
||||
|
||||
# gitsh
|
||||
tap thoughtbot/formulae
|
||||
|
||||
@@ -118,3 +118,14 @@ function gi() {
|
||||
function gci() {
|
||||
npm install --save-dev grunt-contrib-"$@"
|
||||
}
|
||||
|
||||
# syntax highlight the contents of a file or the clipboard and place the result on the clipboard
|
||||
function hl() {
|
||||
if [ -z "$2" ]; then
|
||||
src=$( pbpaste )
|
||||
else
|
||||
src=$( cat $2 )
|
||||
fi
|
||||
|
||||
echo $src | highlight -O rtf --syntax $1 --font Inconsoloata --style moria --font-size 24 | pbcopy
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user