mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 12:07:01 +08:00
fix(zshrc): tmux on msys; feat(common): better perf getting os type and linux dist
This commit is contained in:
parent
96a21666cb
commit
bd2c5eeec1
4
.zshrc2
4
.zshrc2
|
@ -16,6 +16,7 @@ export GPG_TTY=$(tty)
|
||||||
export LESS_TERMCAP_md=$'\E[01;33m'
|
export LESS_TERMCAP_md=$'\E[01;33m'
|
||||||
# env for dfs
|
# env for dfs
|
||||||
if [[ -f ~/.config/dotfiles/env ]]; then set -a; source ~/.config/dotfiles/env; set +a; fi
|
if [[ -f ~/.config/dotfiles/env ]]; then set -a; source ~/.config/dotfiles/env; set +a; fi
|
||||||
|
export DFS_OS_TYPE="$("$DOTFILES/tools/common.sh" get_os_type)"
|
||||||
|
|
||||||
# antigen
|
# antigen
|
||||||
if [[ "$DFS_NO_WALL" == "1" ]]; then
|
if [[ "$DFS_NO_WALL" == "1" ]]; then
|
||||||
|
@ -104,7 +105,8 @@ alias "se"='sudo -sE'
|
||||||
alias "sl"='sudo zsh -l'
|
alias "sl"='sudo zsh -l'
|
||||||
alias "cps"='rsync -avh --info=progress2'
|
alias "cps"='rsync -avh --info=progress2'
|
||||||
alias "mvs"='rsync -avh --info=progress2 --remove-source-files'
|
alias "mvs"='rsync -avh --info=progress2 --remove-source-files'
|
||||||
if [[ $("$DOTFILES/tools/common.sh" get_os_type) == "linux" ]]; then alias "ping"='ping -n'; alias "ping6"='ping6 -n'; fi
|
if [[ "$DFS_OS_TYPE" == "linux" ]]; then alias "ping"='ping -n'; alias "ping6"='ping6 -n'; fi
|
||||||
|
if [[ "$DFS_OS_TYPE" == "msys" ]]; then alias "tmux"='script -qO /dev/null -c "tmux -u"'; fi
|
||||||
alias "pbd"='ping baidu.com'
|
alias "pbd"='ping baidu.com'
|
||||||
alias "p114"='ping 114.114.114.114'
|
alias "p114"='ping 114.114.114.114'
|
||||||
alias "p666"='ping6 2001:da8::666'
|
alias "p666"='ping6 2001:da8::666'
|
||||||
|
|
|
@ -190,6 +190,7 @@ apost_beacon()
|
||||||
|
|
||||||
get_os_type()
|
get_os_type()
|
||||||
{
|
{
|
||||||
|
test -z "$DFS_OS_TYPE" || ( echo "$DFS_OS_TYPE"; return )
|
||||||
local ans="unknown"
|
local ans="unknown"
|
||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
Darwin*) ans="MacOS";;
|
Darwin*) ans="MacOS";;
|
||||||
|
@ -198,11 +199,13 @@ get_os_type()
|
||||||
Linux* ) ans="Linux";;
|
Linux* ) ans="Linux";;
|
||||||
*) ans="unknown";;
|
*) ans="unknown";;
|
||||||
esac
|
esac
|
||||||
|
export DFS_OS_TYPE="$ans"
|
||||||
echo $ans | tr '[:upper:]' '[:lower:]'
|
echo $ans | tr '[:upper:]' '[:lower:]'
|
||||||
}
|
}
|
||||||
|
|
||||||
get_linux_dist()
|
get_linux_dist()
|
||||||
{
|
{
|
||||||
|
test -z "$DFS_LINUX_DIST" || ( echo "$DFS_LINUX_DIST"; return )
|
||||||
local ans="unknown"
|
local ans="unknown"
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
|
@ -221,6 +224,7 @@ get_linux_dist()
|
||||||
else
|
else
|
||||||
ans="unknown"
|
ans="unknown"
|
||||||
fi
|
fi
|
||||||
|
export DFS_LINUX_DIST="$ans"
|
||||||
echo $ans | tr '[:upper:]' '[:lower:]'
|
echo $ans | tr '[:upper:]' '[:lower:]'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user