MacOS(Unix体系)炫酷完美终端装备
MacOS(Unix体系)炫酷完美终端装备
1 下载装置 iTerm2
1.1 iTerm2,没有上架到AppStore,只能经过下载zip包装置,这是下载地址: https://iterm2.com/downloads.html ,压缩包双击翻开后,将解压后的App拖动到【应用程序】文件夹就完成了。
1.2 翻开iTerm2 装备如下图,iTerm2设置->Profiles->Colors->Color Presets…,在下拉菜单中挑选 Solarized Dark封闭一切窗口后,主动退出APP。
2 装置装备 oh-my-zsh
2 .1 装置 oh-my-zsh
2.1.1 装置 oh-my-zsh 之前,需求保证本地现已装置了 git。
(假如没装git,Mac用户请 :brew install git
,Linux运用 sudo apt install git )
2.1.2 查验之前是否装置oh-my-zsh, 假如本来装置,则需求履行以下指令删去:
# 履行 cd ~ 指令进入用户当时目录删去带有oh-my-zsh的文件和目录
cd ~
rm -rf .oh-my-zsh
rm -rf .zshrc.pre-oh-my-zsh
2.1.3 运用 curl 下载脚本并装置:
chsh -s /bin/zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# github加快装备
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 没有梯子的运用国内镜像源
sh -c "$(curl -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"
# 国外源
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
# 国内源
git clone https://gitee.com/mo2/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://gitee.com/twd2606/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://gitee.com/wangnd/zsh-completions.git ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
2.1.4 在装置之前,假如你运用的shell不是zshell,能够运用下面的指令切换到zshell;需求输入暗码验证!
chsh -s /bin/zsh
2.1.5 或许运用 wget 下载脚本并装置:
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
2.2 装备 oh-my-zsh
2.2.1 oh-my-zsh 装备 powerlevel10k 主题款式
除了内置主题外,还能够挑选其他开源的主题,强烈推荐测验一下 powerlevel10k 主题,一个顶十个,项目地址为:https://github.com/romkatv/powerlevel10k。下载装置完成后,需求在~/.zshrc
装备内容: ZSH_THEME="powerlevel10k/powerlevel10k",装置一下指令进程即可!把插件下载到本地的 ~/.oh-my-zsh/custom/themes 目录:
# 1. 下载主题款式
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# 国内源
git clone --depth=1 https://gitcode.com/gh_mirrors/po/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# 2. 运用 vim ~/.zshrc翻开文件,在.zshrc文件内修正增加以下内容
ZSH_THEME="powerlevel10k/powerlevel10k"
# 3. 有必要履行收效指令
source ~/.zshrc
2.2.2 装备主动补全插件 zsh-autosuggestions, plugins小括号内每种插件有必要以空格间离隔
zsh-autosuggestions 依据历史记录和当时的输入,显现完好指令提示,按下Tab或许Ctrl+E都能够主动补全,这个真的很便利;把插件下载到本地的 ~/.oh-my-zsh/custom/plugins 目录:
# 1. 下载主动补全插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 2. 运用 vim ~/.zshrc翻开文件,在.zshrc文件内修正增加以下内容, plugins小括号内每种插件有必要以空格间离隔
plugins=(git zsh-autosuggestions)
# 3. 有必要履行收效指令
source ~/.zshrc
2.2.3 装备主动补全插件 zsh-syntax-highlighting, plugins小括号内每种插件有必要以空格间离隔
zsh-syntax-highlighting 是一个指令语法校验插件,在输入指令的进程中,若指令不合法,则指令显现为赤色,若指令合法就会显现为绿色。把插件下载到本地的 ~/.oh-my-zsh/custom/plugins 目录:
# 1. 下载语法校验和高亮提示插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 2. 运用 vim ~/.zshrc翻开文件,在.zshrc文件内修正增加以下内容, plugins小括号内每种插件有必要以空格间离隔
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
# 3. 有必要履行收效指令
source ~/.zshrc
2.3 plugins小括号内每种插件有必要以空格间离隔
因为 oh-my-zsh 内置了 git(.zshrc本来就存在)、z和sudo 插件,所以只需求在 .zshrc 中,把 git、z和sudo 参加插件列表。
plugins=(git zsh-syntax-highlighting sudo zsh-autosuggestions z)
lsd是一个rust写的代替ls的指令,能够依据文件和目录特点,在前面显现一个图标。装置方法如下:
brew install lsd
参阅文章
1 Mac运用-完美终端
2 装置oh-my-zsh,装备指令行高亮,指令提示,打造高效终端
3 macOS装置装备oh-my-zsh