1. 切换为zsh环境
切换至zshchsh -s /bin/zsh
,并重启终端
2. 安装oh my zsh
执行下列命令之一:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
oh my zsh 官网:https://ohmyz.sh/
3. 安装并配置常用插件
zsh-autosuggestions
:根据历史记录补全命令zsh-syntax-highlighting
: 语法高亮插件
首先下载到~/.oh-my-zsh/plugins
目录下
cd ~/.oh-my-zsh/plugins
git clone git://github.com/zsh-users/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/paulirish/git-open.git
配置.zsh文件
plugins=(
git
zsh-autosuggestions # 根据历史输入指令的记录即时的提示
zsh-syntax-highlighting # 命令高亮
extract # 用 x filename 解压文件
git-open # git open 在浏览器中打开远程仓库
colored-man-pages
z # 模糊跳转
)
4. 其他技巧
在mac中做如下设置来方便地打开文件,个人配置了两个app分别是visual studio code
和textmate
.在.zshrc
下做如下配置
alias text='open -a textmate'
alias vscode='open -a visual\ studio\ code'
使用方法如下
$ text ~/.zshrc
$ vscode ~/.zshrc