1
0
Fork 0

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.
pull/976/head
Hong Xu 9 years ago
parent f2a826e963
commit 7d8fe30a74

@ -111,15 +111,11 @@ if zstyle -t ':prezto:module:utility:grep' color; then
fi fi
# Mac OS X Everywhere # Mac OS X Everywhere
if [[ "$OSTYPE" == darwin* ]]; then if [[ "$OSTYPE" == cygwin* ]]; then
alias o='open'
elif [[ "$OSTYPE" == cygwin* ]]; then
alias o='cygstart' alias o='cygstart'
alias pbcopy='tee > /dev/clipboard' alias pbcopy='tee > /dev/clipboard'
alias pbpaste='cat /dev/clipboard' alias pbpaste='cat /dev/clipboard'
else else
alias o='xdg-open'
if (( $+commands[xclip] )); then if (( $+commands[xclip] )); then
alias pbcopy='xclip -selection clipboard -in' alias pbcopy='xclip -selection clipboard -in'
alias pbpaste='xclip -selection clipboard -out' alias pbpaste='xclip -selection clipboard -out'
@ -129,6 +125,20 @@ else
fi fi
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 pbc='pbcopy'
alias pbp='pbpaste' alias pbp='pbpaste'

Loading…
Cancel
Save