Mac Ohmyz 使用介绍

发布时间: 更新时间: 总字数:1134 阅读时间:3m 作者: IP上海 分享 网址
专栏文章
  1. Mac
  2. Mac
  3. Mac Brew 介绍
  4. Mac Ohmyz 使用介绍(当前)
  5. Mac 快捷键
  6. Mac 常用软件汇总
  7. Mac iTerm2 快捷键
  8. Mac OS X 安裝 bash-completion
  9. Mac 系统制作加密的 zip 压缩包

Oh My Zsh 是基于 zsh 命令行的一个扩展工具集,提供了丰富的扩展功能,本文主要介绍如何使用 Ohmyz

安装

Linux

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

deepin

sudo apt install zsh
chsh -s /bin/zsh
cat /etc/shells

Mac

brew install zsh

更新

cd ~/.oh-my-zsh
git stash
upgrade_oh_my_zsh
git stash pop

配置

ohmyz 的配置文件在 ~/.zshrc 文件中。

Theme

~/.zshrc 中,默认主题是 robbyrussell

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"

Oh My Zsh 默认自带了一些默认主题,存放在 ~/.oh-my-zsh/themes 目录中。

插件

Oh My Zsh 提供的所有插件,都可以在它的插件主页中找到:

https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins

git

配置 ~/.zshrc

plugins=(... git)
AliasCommand
ggit
gagit add
gaagit add –all
gapagit add –patch
gaugit add –update
gavgit add –verbose
gapgit apply
gbgit branch
gbagit branch -a
gbdgit branch -d
gbdagit branch –no-color –merged | command grep -vE “^(*|\s*(master|develop|dev)\s*$)” | command xargs -n 1 git branch -d
gbDgit branch -D
gblgit blame -b -w
gbnmgit branch –no-merged
gbrgit branch –remote
gbsgit bisect
gbsbgit bisect bad
gbsggit bisect good
gbsrgit bisect reset
gbssgit bisect start
gcgit commit -v
gc!git commit -v –amend
gcn!git commit -v –no-edit –amend
gcagit commit -v -a
gca!git commit -v -a –amend
gcan!git commit -v -a –no-edit –amend
gcans!git commit -v -a -s –no-edit –amend
gcamgit commit -a -m
gcsmgit commit -s -m
gcbgit checkout -b
gcfgit config –list
gclgit clone –recurse-submodules
gcleangit clean -id
gpristinegit reset –hard && git clean -dfx
gcmgit checkout master
gcdgit checkout develop
gcmsggit commit -m
gcogit checkout
gcountgit shortlog -sn
gcpgit cherry-pick
gcpagit cherry-pick –abort
gcpcgit cherry-pick –continue
gcsgit commit -S
gdgit diff
gdcagit diff –cached
gdcwgit diff –cached –word-diff
gdctgit describe –tags $(git rev-list –tags –max-count=1)
gdsgit diff –staged
gdtgit diff-tree –no-commit-id –name-only -r
gdvgit diff -w $@ | view -
gdwgit diff –word-diff
gfgit fetch
gfagit fetch –all –prune
gfggit ls-files | grep
gfogit fetch origin
gggit gui citool
ggagit gui citool –amend
ggfgit push –force origin $(current_branch)
ggflgit push –force-with-lease origin $(current_branch)
gglgit pull origin $(current_branch)
ggpgit push origin $(current_branch)
ggpnpggl && ggp
ggpullgit pull origin “$(git_current_branch)”
ggpurggu
ggpushgit push origin “$(git_current_branch)”
ggsupgit branch –set-upstream-to=origin/$(git_current_branch)
ggugit pull –rebase origin $(current_branch)
gpsupgit push –set-upstream origin $(git_current_branch)
ghhgit help
gignoregit update-index –assume-unchanged
gignoredgit ls-files -v | grep “^[[:lower:]]”
git-svn-dcommit-pushgit svn dcommit && git push github master:svntrunk
gkgitk –all –branches
gkegitk –all $(git log -g –pretty=%h)
glgit pull
glggit log –stat
glgpgit log –stat -p
glgggit log –graph
glggagit log –graph –decorate –all
glgmgit log –graph –max-count=10
glogit log –oneline –decorate
glolgit log –graph –pretty=’%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
glolsgit log –graph –pretty=’%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –stat
glodgit log –graph –pretty=’%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'
glodsgit log –graph –pretty=’%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset’ –date=short
glolagit log –graph –pretty=’%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –all
gloggit log –oneline –decorate –graph
glogagit log –oneline –decorate –graph –all
glp_git_log_prettily
gmgit merge
gmomgit merge origin/master
gmtgit mergetool –no-prompt
gmtvimgit mergetool –no-prompt –tool=vimdiff
gmumgit merge upstream/master
gmagit merge –abort
gpgit push
gpdgit push –dry-run
gpfgit push –force-with-lease
gpf!git push –force
gpoatgit push origin –all && git push origin –tags
gpugit push upstream
gpvgit push -v
grgit remote
gragit remote add
grbgit rebase
grbagit rebase –abort
grbcgit rebase –continue
grbdgit rebase develop
grbigit rebase -i
grbmgit rebase master
grbsgit rebase –skip
grhgit reset
grhhgit reset –hard
grohgit reset origin/$(git_current_branch) –hard
grmgit rm
grmcgit rm –cached
grmvgit remote rename
grrmgit remote remove
grsetgit remote set-url
grtcd “$(git rev-parse –show-toplevel || echo .)”
grugit reset –
grupgit remote update
grvgit remote -v
gsbgit status -sb
gsdgit svn dcommit
gshgit show
gsigit submodule init
gspsgit show –pretty=short –show-signature
gsrgit svn rebase
gssgit status -s
gstgit status
gstagit stash push
gstagit stash save
gstaagit stash apply
gstcgit stash clear
gstdgit stash drop
gstlgit stash list
gstpgit stash pop
gstsgit stash show –text
gstallgit stash –all
gsugit submodule update
gtsgit tag -s
gtvgit tag | sort -V
gtlgtl(){ git tag –sort=-v:refname -n -l ${1}* }; noglob gtl
gunignoregit update-index –no-assume-unchanged
gunwipgit log -n 1 | grep -q -c “--wip--” && git reset HEAD~1
gupgit pull –rebase
gupvgit pull –rebase -v
gupagit pull –rebase –autostash
gupavgit pull –rebase –autostash -v
glumgit pull upstream master
gwchgit whatchanged -p –abbrev-commit –pretty=medium
gwipgit add -A; git rm $(git ls-files –deleted) 2> /dev/null; git commit –no-verify –no-gpg-sign -m “–wip– [skip ci]”

配置 ~/.zshrc

plugins=(... web-search)

使用:

  • google ohmyz # 打开 google 搜索 ohmyz
  • baidu ohmyz # 打开 baidu 搜索 ohmyz
  • bing ohmyz # 打开 bing 搜索 ohmyz

wd

wd 的作用就是能够快速的切换到常用的目录,使用方法:

  • 进入目标目录:如 cd /etc/nginx/conf.d
  • 设置快捷键:如 wd add nc,其中 nc 是标识名
  • 快速切换目录:如 wd nc后,将会自动切换到 /etc/nginx/conf.d 目录中
  • 删除快捷键:如 wd rm nc,删除后快捷键将失效

参考

  1. https://ohmyz.sh/
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数