centos 安装zsh 及其插件

安装zsh

$ yum install zsh -y

安装oh-my-zsh

$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

卸载oh-my-zsh

$ uninstall_oh_my_zsh 

默认zsh

chsh -s /bin/zsh

安装autojump

安装autojump

$ yum install autojump -y

配置.zshrc文件

plugins=(
  git autojump
)

安装autojump-zsh

因为是再centos下安装的,所以,这里需要安装autojump-zsh,否则会提示

$ yum install autojump-zsh

重载配置

$ source .zshrc
# 退出并重新进去zsh
$ exit
$ zsh

安装zsh-autosuggestions

安装zsh-autosuggestions

$ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

修改配置

plugins=(
  git autojump zsh-autosuggestions
)

重载配置

安装zsh-syntax-highlighting

自动帮你检测命令是否可用,如果不可用,红色标记,可用绿色标记

安装zsh-syntax-highlighting

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

修改配置

plugins=(
  ...... zsh-syntax-highlighting
)

git 快捷键

g - git
gst - git status
gl - git pull
gup - git pull --rebase
gp - git push
gd - git diff
gdc - git diff --cached
gdv - git diff -w "$@" | view
gc - git commit -v
gc! - git commit -v --amend
gca - git commit -v -a
gca! - git commit -v -a --amend
gcmsg - git commit -m
gco - git checkout
gcm - git checkout master
gr - git remote
grv - git remote -v
grmv - git remote rename
grrm - git remote remove
gsetr - git remote set-url
grup - git remote update
grbi - git rebase -i
grbc - git rebase --continue
grba - git rebase --abort
gb - git branch
gba - git branch -a
gcount - git shortlog -sn
gcl - git config --list
gcp - git cherry-pick
glg - git log --stat --max-count=10
glgg - git log --graph --max-count=10
glgga - git log --graph --decorate --all
glo - git log --oneline --decorate --color
glog - git log --oneline --decorate --color --graph
gss - git status -s
ga - git add
gm - git merge
grh - git reset HEAD
grhh - git reset HEAD --hard
gclean - git reset --hard && git clean -dfx
gwc - git whatchanged -p --abbrev-commit --pretty=medium
gsts - git stash show --text
gsta - git stash
gstp - git stash pop
gstd - git stash drop
ggpull - git pull origin $(current_branch)
ggpur - git pull --rebase origin $(current_branch)
ggpush - git push origin $(current_branch)
ggpnp - git pull origin $(current_branch) && git push origin $(current_branch)
glp - _git_log_prettily

zsh安装主题

克隆主题

git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"

复制主题

ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

设置主题

ZSH_THEME="spaceship"

重启zsh

incr自动提示

不过我感觉用了有点卡...

mkdir -p ~/.oh-my-zsh/custom/plugins/incr
cd ~/.oh-my-zsh/custom/plugins/incr
wget http://mimosa-pudica.net/src/incr-0.2.zsh

修改.zshrc文件

在.zshrc末尾追加这一行

source ~/.oh-my-zsh/plugins/incr/incr*.zsh
source ~/.zshrc

zsh 设置tablename插件

不过it2-tabname在zsh下好像没有用,因为zsh的tabname是当前目录位置

有时候登录服务器tabname就是不显示,,最后终于找到原因了

file

oh-my-zsh使用pure主题

换个主题换个心情

安装主题

npm install --global pure-prompt

设置.zshrc文件

在文件最后追加这两行

autoload -U promptinit; promptinit
prompt pure
source ~/.zshrc

git-open插件

这个可以浏览器打开git项目

git open
git clone https://github.com/paulirish/git-open.git $ZSH_CUSTOM/plugins/git-open
plugins=(其他的插件 git-open)

参考文章