[TOC] # 安装 ~~~ # 安装zsh yum install zsh -y # 安装oh my zsh wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh 或者 sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" ~~~ 替换bash为zsh(注意路径,不知道的话可以which下): ~~~ echo "/usr/bin/zsh" | tee -a /etc/shells chsh -s /usr/bin/zsh ~~~ 查看zsh版本 ~~~ zsh --version ~~~ 编译安装zsh ~~~ wget http://sourceforge.net/projects/zsh/files/zsh/5.0.7/zsh-5.0.7.tar.bz2/download && tar xvjf zsh-5.0.7.tar.bz2 && cd zsh-5.0.7 ~~~ 编译安装 ~~~ ./configure && make && sudo make install ~~~ 安装了zsh 使用vim出现了如下错误 ~~~ arguments:450: _vim_files: function definition file not found _arguments:450: _vim_files: function definition file not found _arguments:450: _vim_files: function definition file not found ~~~ 解决办法,执行下面命令 ~~~ rm ~/.zcompdump* ~~~ 关闭所有终端,重新打开继续使用vim就不会出现这个问题了 # 编辑器 mac打开vscode,sublime,atom atom要安装他自己的命令行工具 ~~~ alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" #alias atom="/Applications/Atom.app/Contents/MacOS/Atom" alias vscode="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code" ~~~ 升级了 oh-my-zsh 也一样,打开终端后,加载到 oh-my-zsh 很慢。 但是使用 iTerm2 打开就非常快,几乎感觉不到。 ~~~ sudo rm -rf /private/var/log/asl/*.asl ~~~ # oh my zsh 升级oh my zsh ~~~ upgrade_oh_my_zsh ~~~ zsh-autosuggestions可以历史命令提示 可以维护下`~/.zsh_history`这个 ctrl+R和command+R也行 # 插件 ~~~ plugins=(git web-search autojump zsh-syntax-highlighting zsh-autosuggestions zsh-completions colored-man-pages extract zsh_reload) ~~~ 插件好像在这个下面`~/.oh-my-zsh/plugins/`,这下面有的话直接加入是没问题的,没有的话就要这样 **对应OSX用户** ~~~ brew install zsh-syntax-highlighting ~~~ 会自动下载这个插件,并将 ~~~ source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ~~~ 这一句加在你的~/.zshrc中。 如果遇到highlighters directory not found这个问题,就 ~~~ export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/usr/local/share/zsh-syntax-highlighting/highlighters ~~~ `brew info zsh-syntax-highlighting`可以看到 **对于Oh-my-zsh用户** ~~~ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh}/plugins/zsh-syntax-highlighting ~~~ 位置有可能是`~/.oh-my-zsh/custom/plugins`也有可能是在`~/.oh-my-zsh/plugins`看配置文件~/.zshrc中的注释吧 同理 ~~~ git clone git://github.com/zsh-users/zsh-autosuggestions ~~~ 这个也是 然后激活这个插件,通过在 ~~~ ~/.zshrc ~~~ 中加入插件的名字 ~~~ plugins=( [plugins...] zsh-syntax-highlighting) ~~~ 最后当然是source一下,让改变生效 ~~~ source ~/.zshrc ~~~ # 主题 ~~~ #THEME #ZSH_THEME="robbyrussell" #ZSH_THEME="cloud" ZSH_THEME="dpoggi" ~~~ # 禁止oh-my-zsh自动更新 在~/.zshrc中添加 ~~~ DISABLE_UPDATE_PROMPT=true DISABLE_AUTO_UPDATE=true ~~~ # irb 也可搜历史 ~/.inputrc ~~~ set show-all-if-ambiguous on set completion-ignore-case on # utf-8 I/O set input-meta on set output-meta on set convert-meta off # home 和 end (mac 是 fn+左 / fn+右,另外我把iterm的cmd+左/右也绑成了home/end) "\e[1~": beginning-of-line "\e[4~": end-of-line # page up 和 page down 搜索历史 (mac 是 fn+上 / fn+下) "\e[5~": history-search-backward "\e[6~": history-search-forward # 绑定快速输入一些代码的快捷键 "\C-l": "λ" "\C-r": "require 'active_support/all'" ~~~ # autojump ~~~ yum install autojump -y ~~~