总代码
1 2 3 4
| sudo apt-get update sudo apt install zsh chsh -s /bin/zsh sh -c "$(curl -fsSL https://gitee.com/Devkings/oh_my_zsh_install/raw/master/install.sh)"
|
安装zsh
1 2
| sudo apt install zsh chsh -s /bin/zsh
|
新方法:
直接将install.sh文件中的这两行代码进行修改:
1 2
| REPO=${REPO:-ohmyzsh/ohmyzsh} REMOTE=${REMOTE:-https://github.com/${REPO}.git}
|
1 2
| REPO=${REPO:-mirrors/oh-my-zsh} REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}
|
项目地址:https://github.com/ohmyzsh/ohmyzsh
直接下载安装即可,如果服务器无法访问GitHub,则需要使用这个补丁:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| diff --git a/tools/install.sh b/tools/install.sh index a6538f9d..04fa80c8 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -264,40 +264,8 @@ setup_ohmyzsh() { umask g-w,o-w - - echo "${FMT_BLUE}Cloning Oh My Zsh...${FMT_RESET}" - - command_exists git || { - fmt_error "git is not installed" - exit 1 - } - - ostype=$(uname) - if [ -z "${ostype%CYGWIN*}" ] && git --version | grep -Eq 'msysgit|windows'; then - fmt_error "Windows/MSYS Git is not supported on Cygwin" - fmt_error "Make sure the Cygwin git package is installed and is first on the \$PATH" - exit 1 - fi - - - git init --quiet "$ZSH" && cd "$ZSH" \ - && git config core.eol lf \ - && git config core.autocrlf false \ - && git config fsck.zeroPaddedFilemode ignore \ - && git config fetch.fsck.zeroPaddedFilemode ignore \ - && git config receive.fsck.zeroPaddedFilemode ignore \ - && git config oh-my-zsh.remote origin \ - && git config oh-my-zsh.branch "$BRANCH" \ - && git remote add origin "$REMOTE" \ - && git fetch --depth=1 origin \ - && git checkout -b "$BRANCH" "origin/$BRANCH" || { - [ ! -d "$ZSH" ] || { - cd - - rm -rf "$ZSH" 2>/dev/null - } - fmt_error "git clone of oh-my-zsh repo failed" - exit 1 - } + cp -ra "$(dirname "$0")"/.. $ZSH + rm -rf $ZSH/.git cd -
|
将这个文件放到ohmyzsh文件夹下,命名为:offline_install.diff,然后运行:
1
| git apply offline_install.diff
|
运行 OH My ZSH 中 tool/install.sh即可安装。
也可以直接用这行代码安装:
1
| sh -c "$(curl -fsSL https://gitee.com/Devkings/oh_my_zsh_install/raw/master/install.sh)"
|
配置powerlevel10k主题
1
| git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
|
或者运行:
1
| git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
|
然后重启终端,即可进入配置步骤,按步骤选择即可。