/
.zshrc
81 lines (71 loc) · 2.67 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Load colors
autoload -U colors && colors
# Git branch auto completion
autoload -U compinit
compinit
# Prompt - https://dustri.org/b/my-zsh-configuration.html
setopt PROMPT_SUBST # allow funky stuff in prompt
PROMPT="[%{$fg_bold[white]%}%n%{$reset_color%}@%m% %u %{$fg[green]%}%c%{$reset_color%}]$ "
# Aliases
# Directories
alias re="cd ~/repos"
alias dot="cd ~/dotfiles"
alias mor="cd ~/repos/mor-web-client"
alias mora="cd ~/repos/mor-api"
alias qpp="cd ~/repos/qpp-ui"
# ls color always
if [[ $(uname -s) = "Darwin" ]]; then
alias ls="ls -G"
else
alias ls="ls --color=always"
fi
alias ll="ls -al"
# Shell scripts
alias vimstart="source $HOME/.scripts/vimstart.sh"
alias rsr="source $HOME/.scripts/ripgrep-search-replace.sh"
alias hic="source $HOME/.scripts/ah-branch-prefix.sh"
alias vpn="anyconnect split"
alias cov="open ./coverage/lcov-report/index.html"
# Git
alias ga="git add"
alias gb="git branch"
alias gbd="git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'"
alias gcb="git checkout -b"
alias gcd="git checkout develop"
alias gcmsg="git commit -m"
alias gco="git checkout"
alias gd="git diff"
alias gds="git diff --staged"
alias gdc="git diff --compact-summary"
alias gf="git fetch"
alias gf="git fetch"
alias ggl='git pull origin "$(git symbolic-ref --short HEAD)"'
alias ggp='git push origin "$(git symbolic-ref --short HEAD)"'
alias glg="git log --oneline --no-merges"
alias gsr="git symbolic-ref --short HEAD"
alias gss="git status -s"
# fzf config
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='rg --files '
# emacs mode
bindkey -e
bindkey '\e[1;5C' vi-forward-word # C-Right
bindkey '\e[1;5D' vi-backward-word # C-Left
# Complete history on arrow up/down
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[[A" up-line-or-beginning-search # Up
bindkey "^[[B" down-line-or-beginning-search # Down
# History - https://dustri.org/b/my-zsh-configuration.html
HISTFILE=~/.zsh_history # where to store zsh history
HISTSIZE=2048 # big history
SAVEHIST=2048 # big history
setopt append_history # append
setopt hist_ignore_all_dups # no duplicate
unsetopt hist_ignore_space # ignore space prefixed commands
setopt hist_reduce_blanks # trim blanks
setopt hist_verify # show before executing history commands
setopt inc_append_history # add commands as they are typed, don't wait until shell exit
setopt share_history # share hist between sessions