diff --git a/Brewfile b/Brewfile index eb54e89..5309daa 100644 --- a/Brewfile +++ b/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 diff --git a/zsh/functions.zsh b/zsh/functions.zsh index a6fbc04..7d62a74 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -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 +}