使用oh-my-zsh之前确保安装过zsh
通过脚本安装: sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
或者 sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
安装完后,在~目录下会存在.zshrc文件。将zsh作为你的默认shell chsh -s `which zsh`
查看有哪些zsh插件可用:
➜ plugins git:(master) cd ~/.oh-my-zsh/plugins ➜ plugins git:(master) ls -d * adb dirpersist gulp per-directory-history svn-fast-info ant django heroku perl swiftpm apache2-macports dnf history perms symfony arcanist docker history-substring-search phing symfony2 archlinux docker-compose httpie pip systemadmin
选择要激活的插件加到.zshrc中去:
➜ ~ grep -i ^plugin ~/.zshrc plugins=(git web-search last-working-dir encode64 urltools wd git-extras)
常见用法:
- .. 或 ... 切换目录,省掉cd
- d 显示之前切换过的目录,输入数字1、2、3来切换目录,数字0代表当前目录不能用
- wd插件
wd add sname 将当前目录以sname为别名存起来
wd sname 类似cd到原目录
wd list 列出所有目录的别名
wd rm sname 删除别名
参考:官方README