-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
executable file
·78 lines (66 loc) · 1.72 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
#!/bin/zsh
# Stephen Humphries
# ZSH Config
#############
### Shell ###
#############
bindkey -e # emacs bindings (e.g. Ctrl-a, Ctrl-e)
bindkey "\e[3~" delete-char
##############
### Prompt ###
##############
set -o PROMPT_SUBST
PS1='%F{cyan}%n@$(hostname | cut -d. -f1)%f:%F{blue}%2~%f$(git_branch_prompt) %F{white}%#%f '
function git_branch_prompt {
GIT_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
if [[ -n "${GIT_BRANCH}" ]]; then
echo " (%F{red}${GIT_BRANCH}%f)"
fi
}
###################
### Environment ###
###################
if [ "$(uname)" = "Darwin" ]; then
PATH="${PATH}:/Users/$(whoami)/bin"
else
PATH="${PATH}:/home/$(whoami)/bin"
fi
export EDITOR="vim"
export BUNDLER_EDITOR="code"
###############
### Aliases ###
###############
# cd
alias ..="cd .."
alias ~="cd ~"
# ls
if [ "$(uname)" = "Darwin" ]; then
alias ls="ls -G" # enable colours
else
alias ls="ls --color"
fi
alias ll="ls -al"
# git
alias gs="git status"
alias ga="git add"
alias gc="git commit"
alias gb="git branch"
alias gl="git log"
function gd { git diff --color=always "$@" | less -r }
alias gco="git checkout"
alias gcm='git checkout $(git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@")'
alias gps="git push --force-with-lease --force-if-includes"
alias gpl="git pull && git remote set-head origin --auto"
alias gbclean="git branch | grep -v \"^*\" | xargs git branch -D"
alias gr="git rebase"
alias gplall='for d in ./*/ ; do (cd "$d" && gpl); done'
# tmux
alias t="tmux"
alias c="tmux save-buffer - | pbcopy && echo 'Saved tmux buffer to clipboard'"
# sudo
if [ "$(uname)" = "Linux" ]; then
alias pacman="sudo pacman"
alias systemctl="sudo systemctl"
fi
alias reboot="sudo reboot"
alias halt="sudo halt"