Oh-My-Zsh 操作 快捷键存档

Oh-My-Zsh的配置主要集中在~/.zshrc里,用 vim 或你喜欢的其他编辑器打开.zshrc

一、快捷命令配置配置常用的命令行:

alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias vi='vim'

最后 source ~/.zshrc

二、配置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

第二种配置方案:

下载item2:

Mac下终端配置(item2 + oh-my-zsh + solarized配色方案) - 希希里之海 - 博客园

oh-my-zsh 配置插件 - 简书

Mac 终端默认 shell 为 bash。
zsh 可能是目前最好的 shell ,至于好在哪里可自行百度。
本文主要介绍使用 zsh 以及 oh-my-zsh 的配置。

使用 zsh

查看当前使用的 shell

echo $SHELL

/bin/bash

查看安装的 shell

cat /etc/shells

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

使用 brew 更新 zsh

brew install zsh

==> Downloading https://homebrew.bintray.com/bottles/zsh-5.5.1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring zsh-5.5.1.high_sierra.bottle.tar.gz
/usr/local/Cellar/zsh/5.5.1: 1,444 files, 12MB

切换为 zsh

chsh -s /bin/zsh

重启终端即可使用 zsh

oh-my-zsh

安装

执行从 oh-my-zsh 的 GitHub 下载的安装脚本

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

  ____  / /_     ____ ___  __  __   ____  _____/ /_  
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ 
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  
                        /____/                       ....is now installed!

Please look over the ~/.zshrc file to select plugins, themes, and options.

p.s. Follow us at https://twitter.com/ohmyzsh.

p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.

主题

打开 oh-my-zsh 配置文件

vim ~/.zshrc

image

配置项 ZSH_THEME 即为 oh-my-zsh 的主题配置,oh-my-zsh 的 GitHub Wiki 页面提供了 主题列表
当设置为 ZSH_THEME=random 时,每次打开终端都会使用一种随机的主题。

更新配置

source ~/.zshrc

自动补全插件(最新版存在bug,不好用,建议使用zsh-autosuggestions)

下载 incr 自动补全插件 http://mimosa-pudica.net/src/incr-0.2.zsh
将插件放在 oh-my-zsh 自定义插件目录中

image

打开 oh-my-zsh 配置文件

vim ~/.zshrc

image

在 plugins 中添加 incr
在配置文件结束添加:

source $ZSH/custom/plugins/incr/incr*.zsh

更新配置

source ~/.zshrc

最终效果如官网所示:

image

自动补全插件zsh-autosuggestions

1、安装zsh-autosuggestions

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

2、编辑~/.zshrc文件
-------- 打开命令行工具进入~/.zshrc文件

  sudo vim ~/.zshrc

-------按i 进入--INSERT--编辑模式,使用上下左右键找找到plugins=(git)这一行添加

plugins=(git zsh-autosuggestions)

保存退出
ESC 回到正常模式
:wq保存并退出vim

更新配置

source ~/.zshrc

Homebrew:
https://brew.sh/index_zh-cn
https://github.com/Homebrew/brew
oh-my-zsh:
https://ohmyz.sh/
https://github.com/robbyrussell/oh-my-zsh
incr:
http://mimosa-pudica.net/zsh-incremental.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值