-
Notifications
You must be signed in to change notification settings - Fork 4
/
dot_bash_aliases
63 lines (55 loc) · 1.53 KB
/
dot_bash_aliases
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
#!/bin/bash
# CD
alias ..='cd ..'
alias ...='cd ../..'
alias cd..='cd ..'
alias cd...='cd ../..'
# LS
alias ls='ls --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alFh'
# GIT
alias gap='git add -p'
alias gd='git diff'
alias gdc='git diff --cached'
alias gg='git grep -n -C2 --color=always'
alias gg0='git grep -n -C0 --color=always'
alias gitroot='cd $(git rev-parse --show-cdup)'
alias gl='git log'
alias grm='git rebase master'
alias gm='git commit -m'
alias gma='git commit --amend --no-edit'
alias gp='git publish'
alias gpr='git pull --rebase'
alias gs='git status -s'
# UTILS
alias open='xdg-open > /dev/null 2>&1'
alias remove_colors='sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g"'
alias c='chezmoi'
# DEVELOPMENT
alias bat='batcat'
alias sandbox='cd ~/Development/sandbox && make'
alias vim='nvim'
alias dc='docker-compose'
notes() {
NEW_NOTE="New note"
NOTES_PATH="${HOME}/.notes"
NOTES=$(find "${NOTES_PATH}" -iname '*.md')
FILE=$(printf "%s\n%s" "${NOTES}" "${NEW_NOTE}" | fzf --prompt='Choose a file: ')
if [ "${FILE}" == "${NEW_NOTE}" ]; then
vim +"cd ${NOTES_PATH}"
else
[[ ! -z "${FILE}" ]] && vim "${FILE}"
fi
}
# Function to restore broken ssh-agent session
# https://coderwall.com/p/_s_xda/fix-ssh-agent-in-reattached-tmux-session-shells
fixssh() {
for key in SSH_AUTH_SOCK SSH_CONNECTION SSH_CLIENT; do
if (tmux show-environment | grep "^${key}" > /dev/null); then
value=`tmux show-environment | grep "^${key}" | sed -e "s/^[A-Z_]*=//"`
export ${key}="${value}"
fi
done
}