- Linux zsh 配置
-
安装zsh: apt install zsh
-
安装oh-my-zsh: (摘抄自:https://ohmyz.sh/#install)
Install oh-my-zsh via curl:
sh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”
Install oh-my-zsh via wget:
sh -c “$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)” -
设置zsh为默认shell: chsh -s /bin/zsh root
- oh-my-zsh github访问速度慢的应对
oh-my-zsh GitHub库地址.
git colne 访问网速太差的话, 可以考虑下面三个措施中的一个:- 下载压缩包ohmyzsh.zip,然后手动配置
- 访问优快云 Code China 镜像库
- 直接运行下面这个脚本也可安装:
#!/bin/sh
#
# This script should be run via curl:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via wget:
# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via fetch:
# sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#
# As an alternative, you can first download the install script and run it afterwards:
# wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
# sh install.sh
#
# You can tweak the install behavior by setting variables when running the script. For
# example, to change the path to the Oh My Zsh repository:
# ZSH=~/.zsh sh install.sh
#
# Respects the following environment variables:
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
# REPO - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)
# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
# BRANCH - branch to check out immediately after install (default: master)
#
# Other options:
# CHSH - 'no' means the installer will not change the default shell (default: yes)
# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
# KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no)
#
# You can also pass some arguments to the install script to set some these options:
# --skip-chsh: has the same behavior as setting CHSH to 'no'
# --unattended: sets both CHSH and RUNZSH to 'no'
# --keep-zshrc: sets KEEP_ZSHRC to 'yes'
# For example:
# sh install.sh --unattended
# or:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
#
set -e
# Track if $ZSH was provided
custom_zsh=${ZSH:+yes}
# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
# REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE='https://codechina.youkuaiyun.com/mirrors/ohmyzsh/ohmyzsh.git'
BRANCH=${BRANCH:-master}
# Other options
CHSH=${CHSH:-yes}
RUNZSH=${RUNZSH:-yes}
KEEP_ZSHRC=${KEEP_ZSHRC:-no}
command_exists() {
command -v "$@" >/dev/null 2>&1
}
fmt_error() {
printf '%sError: %s%s\n' "$BOLD$RED" "$*" "$RESET" >&2
}
fmt_underline() {
printf '\033[4m%s\033[24m\n' "$*"
}
fmt_code() {
# shellcheck disable=SC2016 # backtic in single-quote
printf '`\033