55 lines
1.7 KiB
Bash
55 lines
1.7 KiB
Bash
# 设置啥啊? 给我滚回 zsh !
|
|
if [[ -x /usr/local/bin/zsh ]]; then
|
|
export SHELL=/usr/local/bin/zsh
|
|
exec /usr/local/bin/zsh
|
|
# 我选择执行 多一层(
|
|
# 防止手残
|
|
/usr/local/bin/zsh
|
|
fi
|
|
|
|
|
|
#only for console (ssh/telnet works w/o resize)
|
|
isTTY=$(ps | grep $$ | grep tty)
|
|
#only for bash (bash needs to resize and can support these commands)
|
|
isBash=$(echo $BASH_VERSION)
|
|
#only for interactive (not necessary for "su -")
|
|
isInteractive=$(echo $- | grep i)
|
|
|
|
if [ -n "$isTTY" -a -n "$isBash" -a -n "$isInteractive" ]; then
|
|
shopt -s checkwinsize
|
|
checksize='echo -en "\E7 \E[r \E[999;999H \E[6n"; read -sdR CURPOS;CURPOS=${CURPOS#*[}; IFS="?; \t\n"; read lines columns <<< "$(echo $CURPOS)"; unset IFS'
|
|
eval $checksize
|
|
# columns is 1 in Procomm ANSI-BBS
|
|
if [ 1 != "$columns" ]; then
|
|
export_stty='export COLUMNS=$columns; export LINES=$lines; stty columns $columns; stty rows $lines'
|
|
alias resize="$checksize; columns=\$((\$columns - 1)); $export_stty"
|
|
eval "$checksize; columns=$(($columns - 1)); $export_stty"
|
|
|
|
alias vim='function _vim(){ eval resize; TERM=xterm vi $@; }; _vim'
|
|
else
|
|
alias vim='TERM=xterm vi $@'
|
|
fi
|
|
alias vi='vim'
|
|
alias ps='COLUMNS=1024 ps'
|
|
fi
|
|
|
|
if [ "screen-256color" == $TERM ]; then
|
|
alias htop='TERM=screen htop'
|
|
elif [ "xterm-256color" == $TERM ]; then
|
|
alias htop='TERM=xterm htop'
|
|
fi
|
|
|
|
[ -f ".profile.size_check" ] && . .profile.size_check
|
|
|
|
# for screen
|
|
export TERM=xterm-color
|
|
|
|
# for some weird path
|
|
export PATH=$PATH:/opt/bin/
|
|
export PATH=$PATH:/volume2/docker/
|
|
|
|
# alias
|
|
|
|
alias cls='clear'
|
|
alias ll='lsd -la'
|