安装oh my zsh
在默认shell(bash)下输入以下命令
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
换回bash
which bash
chsh -s /bin/bash
zsh配置文件
~/.zshrc
- 别名设置
alias -s py=vi
- 主题更改
ZSH_THEME
ZSH_THEME="robbyrussell"
主题存放目录 ~/.oh-my-zsh/themes
插件管理
git(默认安装)
对git命令进行简化,如:
gco=git checkout
g=git
gd=git diff
gst=git status
textmate
mr
可以创建 ruby 的框架项目,tm [filename]
可以用 textmate 打开指定文件
autojump
通过记录访问过的目录,实现目录快速跳转
安装
brew install autojump
然后修改~/.bash_profile
或者~/.zshrc
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
运行cd命令会发现报错
OR:root:code for hash md5 was not found.
执行下面命令重装python
brew reinstall python@2
使用
//目录跳转
j dirname
//当前目录统计
j --stat
插件目录~/.oh-my-zsh/plugins
高亮插件
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
~/.zshrc
plugins=(git zsh-syntax-highlighting)
注意zsh-syntax-highlighting必须是最后一个
或者也可以使用HomeBrew进行安装
brew install zsh-syntax-highlighting
命令补全插件
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
~/.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
升级zsh
upgrade_oh_my_zsh
VS Code配置
command+shift+p
输入shell,更改默认shell为zsh,重启vscode
加载~/.bash_profile
更改为zsh之后,打开终端时默认加载~/.zshrc
,如果想保留~/.bash_profile
中的配置项,修改~/.zshrc
,添加一句
source ~/.bash_profile
vim 语法高亮
# 复制配置文件
cp /usr/share/vim/vimrc ~/.vimrc
在文件最后加上以下几行
syntax on
set nu!
set autoindent