mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
This commit is contained in:
commit
62fe9a0185
401 changed files with 43763 additions and 10538 deletions
|
|
@ -1,7 +1,7 @@
|
|||
function zsh_stats() {
|
||||
fc -l 1 \
|
||||
| awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \
|
||||
| grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl
|
||||
| grep -v "./" | sort -nr | head -n 20 | column -c3 -s " " -t | nl
|
||||
}
|
||||
|
||||
function uninstall_oh_my_zsh() {
|
||||
|
|
@ -13,10 +13,6 @@ function upgrade_oh_my_zsh() {
|
|||
omz update
|
||||
}
|
||||
|
||||
function takedir() {
|
||||
mkdir -p $@ && cd ${@:$#}
|
||||
}
|
||||
|
||||
function open_command() {
|
||||
local open_cmd
|
||||
|
||||
|
|
@ -37,27 +33,35 @@ function open_command() {
|
|||
${=open_cmd} "$@" &>/dev/null
|
||||
}
|
||||
|
||||
# take functions
|
||||
|
||||
# mkcd is equivalent to takedir
|
||||
function mkcd takedir() {
|
||||
mkdir -p $@ && cd ${@:$#}
|
||||
}
|
||||
|
||||
function takeurl() {
|
||||
data=$(mktemp)
|
||||
curl -L $1 > $data
|
||||
tar xf $data
|
||||
thedir=$(tar tf $data | head -1)
|
||||
rm $data
|
||||
cd $thedir
|
||||
local data thedir
|
||||
data="$(mktemp)"
|
||||
curl -L "$1" > "$data"
|
||||
tar xf "$data"
|
||||
thedir="$(tar tf "$data" | head -n 1)"
|
||||
rm "$data"
|
||||
cd "$thedir"
|
||||
}
|
||||
|
||||
function takegit() {
|
||||
git clone $1
|
||||
cd $(basename ${1%%.git})
|
||||
git clone "$1"
|
||||
cd "$(basename ${1%%.git})"
|
||||
}
|
||||
|
||||
function take() {
|
||||
if [[ $1 =~ ^(https?|ftp).*\.tar\.(gz|bz2|xz)$ ]]; then
|
||||
takeurl $1
|
||||
takeurl "$1"
|
||||
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
|
||||
takegit $1
|
||||
takegit "$1"
|
||||
else
|
||||
takedir $1
|
||||
takedir "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -241,12 +245,11 @@ function omz_urldecode {
|
|||
tmp=${tmp:gs/\\/\\\\/}
|
||||
# Handle %-escapes by turning them into `\xXX` printf escapes
|
||||
tmp=${tmp:gs/%/\\x/}
|
||||
local decoded
|
||||
eval "decoded=\$'$tmp'"
|
||||
local decoded="$(printf -- "$tmp")"
|
||||
|
||||
# Now we have a UTF-8 encoded string in the variable. We need to re-encode
|
||||
# it if caller is in a non-UTF-8 locale.
|
||||
local safe_encodings
|
||||
local -a safe_encodings
|
||||
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||
if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then
|
||||
decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue