[refactor] clean, readable (#19)

* rebase zshrc, introduce DFS_NO_WALL

* improve ci

* improve ci

* improve ci

* update antigen url for DFS_NO_WALL

* OK

* improve ci for macos

* improve test.zsh

* staged

* fix ci

* fix ci

* use local vars

* introduce DFS_QUIET

* mass mod install.sh

* minor change

* set DFS_DEV=1 to prevent update

* debug: done -> fi

* fix DFS_DEV

* ubuntu.sh: set-mirror (ref: tuna)

* preinstall_check

* install.sh: -q to be quiet

* install.sh: -d to DFS_DEV

Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
This commit is contained in:
2022-11-05 19:45:21 +08:00
committed by GitHub
parent 0739410aef
commit b6ff4116c8
11 changed files with 260 additions and 142 deletions

48
.zshrc2
View File

@@ -1,22 +1,29 @@
# env
export TERM="xterm-256color"
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export DOTFILES=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
export PATH="$PATH:$DOTFILES/scripts"
export LESS="-N"
# antigen
# if test -z "$NO_WALL"; then
# ANTIGEN_OMZ_REPO_URL="https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git"
# ANTIGEN_URL="https://raw.fastgit.org/zsh-users/antigen/master/bin/antigen.zsh"
# GIHUB_PROXY="https://hub.fastgit.xyz/"
# else
# ANTIGEN_URL="git.io/antigen"
# GIHUB_PROXY=""
# fi
# antigen bundle ${GIHUB_PROXY}zsh-users/zsh-syntax-highlighting
# antigen bundle ${GIHUB_PROXY}zsh-users/zsh-completions
# antigen bundle ${GIHUB_PROXY}zsh-users/zsh-autosuggestions
ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git"
ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh"
if [[ -z "$DFS_NO_WALL" ]]; then
ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh"
ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git"
ANTIGEN_PLUGINS=( \
"https://gitee.com/dictxiong/zsh-syntax-highlighting" \
"https://gitee.com/dictxiong/zsh-completions" \
"https://gitee.com/dictxiong/zsh-autosuggestions" \
)
else
ANTIGEN_URL="https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh"
ANTIGEN_OMZ_REPO_URL="https://github.com/ohmyzsh/ohmyzsh.git"
ANTIGEN_PLUGINS=( \
"https://github.com/zsh-users/zsh-syntax-highlighting" \
"https://github.com/zsh-users/zsh-completions" \
"https://github.com/zsh-users/zsh-autosuggestions" \
)
fi
ANTIGEN="$HOME/antigen.zsh"
# Install antigen.zsh if not exist
if [ ! -f "$ANTIGEN" ]; then
@@ -40,9 +47,9 @@ if [ ! -f "$ANTIGEN" ]; then
fi
# config and enable antigen
source "$ANTIGEN"
antigen use oh-my-zsh
# enable plugins
antigen_plugins=( \
antigen use oh-my-zsh
ANTIGEN_PLUGINS+=( \
"command-not-found" \
"docker" \
"extract" \
@@ -52,11 +59,8 @@ antigen_plugins=( \
"tmux" \
"ufw" \
"z" \
"https://gitee.com/dictxiong/zsh-syntax-highlighting" \
"https://gitee.com/dictxiong/zsh-completions" \
"https://gitee.com/dictxiong/zsh-autosuggestions" \
)
for i in ${antigen_plugins[*]}
for i in ${ANTIGEN_PLUGINS[*]}
do
if [[ -z $ANTIGEN_EXCLUDE || ! $i =~ $ANTIGEN_EXCLUDE ]]; then
antigen bundle $i
@@ -75,10 +79,6 @@ antigen theme ${ZSH_THEME:-$TMP_THEME}
antigen apply
# end of antigen config
# env
export DOTFILES=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
export PATH=$PATH:$DOTFILES/scripts
# alias
alias "pls"='sudo $(fc -ln -1)'
alias "se"='sudo -sE'