Created
August 13, 2021 13:24
-
-
Save p-geon/dea9b387a8b23cc3b3a964e84129d5e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 色を使用 | |
autoload -Uz colors | |
colors | |
# scp needs locate this | |
echo "[loading] ~/.zshrc" | |
# 補完 | |
# autoload -Uz compinit | |
# compinit | |
# ヒストリーに重複を表示しない | |
setopt histignorealldups | |
HISTFILE=~/.zsh_history | |
HISTSIZE=10000 | |
SAVEHIST=10000 | |
# コマンドミスを修正 | |
setopt correct | |
# プロンプトを2行で表示、時刻を表示 | |
PROMPT="%(?.%{${fg[green]}%}.%{${fg[red]}%})%n${reset_color}@${fg[blue]}%m${reset_color}(%*%) %~ | |
%# " | |
# 補完後、メニュー選択モードになり左右キーで移動が出来る | |
zstyle ':completion:*:default' menu select=2 | |
# 補完で大文字にもマッチ | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' | |
# Ctrl+rでヒストリーのインクリメンタルサーチ、Ctrl+sで逆順 | |
bindkey '^r' history-incremental-pattern-search-backward | |
bindkey '^s' history-incremental-pattern-search-forward | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
# if ! shopt -oq posix; then | |
# -------------------- | |
# bash | |
# -------------------- | |
alias A="cat ~/.zsh_aliases" | |
alias S="A | grep" | |
# -------------------- | |
# exa | |
# -------------------- | |
alias lllll="ls" | |
alias ls="exa --group-directories-first --color=auto --icons" | |
alias l="ls" | |
alias sl="ls" | |
alias ll="ls -l" | |
alias la="ls -la" | |
alias lt="ls -T" | |
alias T="exa -T --color=auto --icons" | |
alias n="ls -l | wc -n" | |
alias pw="pwd" | |
alias Td="tree -d -L 2 ./" | |
alias T1d="tree -d -L 1 ./" | |
alias T2d="tree -d -L 2 ./" | |
alias T3d="tree -d -L 3 ./" | |
alias T1="tree -L 1 ./" | |
alias T2="tree -L 2 ./" | |
alias T3="tree -L 3 ./" | |
alias TT="tree -d -L 2 ~/" | |
alias TTT="tree -d -L 3 ~/" | |
# -------------------- | |
# cd variant | |
# -------------------- | |
alias ~="cd ~/" | |
alias .="ls" | |
alias ..="cd ../" | |
alias ...="cd ../../" | |
alias ....="cd ../../../" | |
alias .....="cd ../../../../" | |
alias .1="cd ../" | |
alias .2="cd ../../" | |
alias .3="cd ../../../" | |
alias .4="cd ../../../../" | |
alias .5="cd ../../../../../" | |
alias ,="cd -" | |
# -------------------- | |
# git | |
# -------------------- | |
alias g="git" | |
alias gaccount="git config user.name && git config user.email" | |
## add | |
alias gadry="git add -A --dry-run" #pre-check without adding | |
alias ga="git add" | |
alias gaa="git add -A" #all | |
alias gau="git add -u" #exclude untrack files | |
alias gap="git add -p" #patch | |
alias unadd="git reset --mixed HEAD" # revert add | |
## commit | |
alias gc="git commit -m" | |
alias gam="git commit --amend" | |
alias uncommit="git reset --soft HEAD^" # revert commit | |
## pull/push | |
alias gpl="git pull origin main" | |
alias gp="git push" | |
alias main="git push origin main" | |
alias master="git push origin master" | |
alias defaultmain="git config --global init.defaultBranch main" | |
alias master2main="git branch -m master main && git push -u origin main" | |
alias gacp="git add -A && git commit -m 'update' && git push origin main" | |
## branch | |
alias gb="git branch" | |
alias gout="git checkout" | |
alias merge="git merge --squash" | |
alias gmastermain="git branch -m master main" | |
alias gdeloriginbranch="git push --delete origin" # + branchname | |
# show & logging | |
alias gl="git log --oneline" | |
alias gg="git log --graph --all --format='%x09%an%x09%h %d %s'" | |
alias ggg="git log --graph --date=short --decorate=short --pretty=format:'%Cgreen%h %Creset%cd %Cblue%cn %Cred%d %Creset%s'" | |
alias gs="git status" | |
alias gss="git status -s" | |
alias gshow="git log --name-status HEAD^..HEAD" # show last commit status & files | |
## config | |
alias gcl="git config --list" | |
## stash | |
alias gswap="git stash -u && git checkout -b swap && git stash pop" | |
# -------------------- | |
# others | |
# -------------------- | |
# specific | |
alias dud="du -d 2 -m" | |
alias heavy-search="du -ah ./ | sort -rh | head -5" | |
# OS-utils | |
alias show-architecture="uname -moi" | |
alias show-os="cat /etc/os-release" | |
# basic-commands | |
alias a="alias" | |
alias q="exit" | |
alias c="clear" | |
alias reload="exec bash -l" | |
alias G="grep" | |
alias p="pwd" | |
alias sd360="sudo shutdown -h +360" | |
echo "[loaded] ~/.zshrc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment