From 7d8fe30a74d1ffb0f7f65dc4cc60df65964d7021 Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Tue, 22 Sep 2015 15:14:41 -0700 Subject: [PATCH] Make "o" to be able to open multiple files Current "o" is simply an alias of the default open command on a specific platform. This commit replaces this alias with a function, which accepts arbitrary number of arguments to open multiple files with default applications at one command. --- modules/utility/init.zsh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index fd7aaf6e..56b7bd67 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -111,15 +111,11 @@ if zstyle -t ':prezto:module:utility:grep' color; then fi # Mac OS X Everywhere -if [[ "$OSTYPE" == darwin* ]]; then - alias o='open' -elif [[ "$OSTYPE" == cygwin* ]]; then +if [[ "$OSTYPE" == cygwin* ]]; then alias o='cygstart' alias pbcopy='tee > /dev/clipboard' alias pbpaste='cat /dev/clipboard' else - alias o='xdg-open' - if (( $+commands[xclip] )); then alias pbcopy='xclip -selection clipboard -in' alias pbpaste='xclip -selection clipboard -out' @@ -129,6 +125,20 @@ else fi fi +function o() { + open_cmd='xdg-open' + if [[ "$OSTYPE" == darwin* ]]; then + open_cmd='open' + elif [[ "$OSTYPE" == cygwin* ]]; then + open_cmd='cygstart' + fi + + for f in "$@" + do + $open_cmd $f + done +} + alias pbc='pbcopy' alias pbp='pbpaste'