手动安装 github https://github.com/ohmyzsh/ohmyzsh
1 克隆仓库 1 2 3 git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh 或者 git clone git@github.com:ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
2 将原来的~/.zshrc备份 1 cp ~/.zshrc ~/.zshrc.bak
3 用新的zsh配置文件 1 cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
4 使得zsh变成默认的shell
5 配置文件 zsh的配置文件存在当前用户目录中的.zshrc文件,如果你发现切换了shell之后,以前的配置的环境变量不生效了,可以打开 .zshrc文件,找到:
指定配置的环境变量文件,之后运行:
设置主题 设置固定主题
安装完毕后,我们就可以使用了,先来简单配置一下,Oh My Zsh 提供了很多主题风格,我们可以根据自己的喜好,设置主题风格
1 2 3 4 5 6 7 open ~/.zshrc ZSH_THEME="robbyrussell"
设置随机主题
1 [oh-my-zsh] Random theme '/Users/xxxx/.oh-my-zsh/themes/zhann.zsh-theme' loaded...
其中 zhann.zsh-theme 是主题的名称, 有喜欢的童鞋可以记录保留.
查看主题名称
Oh My Zsh 默认自带了一些默认主题,存放在 ~/.oh-my-zsh/themes 目录中。我们可以查看这些主题
终端输入:
1 cd ~/.oh-my-zsh/themes && ls
卸载 Oh My Zsh
1 2 uninstall_oh_my_zsh Are you sure you want to remove Oh My Zsh? [y/N] Y
1 2 3 4 5 6 Removing ~/.oh-my-zsh Looking for original zsh config... Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc Found ~/.zshrc -- Renaming to ~/.zshrc.omz-uninstalled-20170820200007 Your original zsh config was restored. Please restart your session. Thanks for trying out Oh My Zsh. It's been uninstalled.
插件 manjaro自带插件 自己下载的插件放在/home/kiylx/.oh-my-zsh/custom/plugins/
1 2 3 4 5 6 7 8 9 位置/usr/share/zsh/plugins/ 一共三个 zsh-autosuggestions zsh-history -substring-search zsh-syntax -highlightingps :1 .其中zsh-history -substring-search 是ohmyzsh自带的,只是名称不同,是history -substring-search 。2 .zsh-syntax -highligting必须排最后一个
git 这个是装好oh-my-zsh 就默认已经开启的
查看所有的git命令alias
1 ~/.oh-my-zsh/ plugins/git/gi t.plugin.zsh
z 这个是oh-my-zsh默认就装好的,需要自己开启。还有一个autojump的插件和z功能差不多,autojump需要单独装,
如果z插件历史记录太多,并且有一些不是自己想要的,可以删除
auto-suggestions 1 git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
zsh-syntax-highligting 1 git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ## git open 插件 $ git open # opens https: $ git open someremote# opens https: $ git open someremote somebranch# opens https: $ git open --issue# If branches use naming convention of issues/#123, # opens https: $ git open --print # prints https: $ git open --suffix pulls# opens https:
thefuck修正命令 github
配置
在.bash_profile, .bashrc, .zshrc or 其他启动脚本文件中添加
1 2 3 4 eval $(thefuck --alias )eval $(thefuck --alias FUCK)
让配置立即生效,需要重启终端,,或者,输入source ~/.bashrc (或者你的shell配置文件名称 .zshrc).
修改~/.zshrc文件 1 2 3 4 5 6 7 8 9 10 11 12 13 例子 plugins=( git pip extract z wd auto-suggestions zsh-syntax-highligting auto-jumplast-working-dir ) ZSH_THEME="robbyrussell"
如果想要启用某个插件,装好之后直接修改 plugins = (插件A 插件B 插件C) git 这个是装好oh-my-zsh 就默认已经开启的 查看所有的git命令alias ~/.oh-my-zsh/plugins/git/git.plugin.zsh z 这个是oh-my-zsh默认就装好的,需要自己开启。还有一个autojump的插件和z功能差不多,autojump需要单独装, 如果z插件历史记录太多,并且有一些不是自己想要的,可以删除 z -x 不要的路径