-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaliases.sh
64 lines (51 loc) · 1.71 KB
/
aliases.sh
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
# --color=auto is not available everywhere
ls --color &> /dev/null && alias ls="ls -Fh --color" || alias ls="ls -GFh"
# Use neovim if available
if command_exists nvim; then
alias vim=nvim;
fi
alias ..='cd ..'
alias ll='ls -lrth'
alias la='ls -a'
alias vi='vim -u ~/.vim/sane_vimrc'
# Shortcut to create new tmux with pwd as session name
alias tmux='tmux -2 -u'
alias newtmux='tmux new -s ${PWD##*/}'
alias e='tmux split-window -h vim $@'
alias mkdir='mkdir -pv'
alias reload="source ~/.bash_profile"
alias gr='rg --column --line-number --no-heading --fixed-strings --ignore-case --follow --hidden --glob "!.git/*" --color "always"'
# fzf vim
alias vip='vim +FZF'
alias vig='vim -c "Git | only | nmap e :q<CR>"'
# Git aliases
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gcm='git commit'
alias gd='git diff'
alias gco='git checkout '
alias gcl='git clean -df'
alias diff='git difftool HEAD'
alias gpl='git pull'
alias gps='git push'
alias gemail='git config user.email'
alias gname='git config user.name'
alias groot='cd $(git rev-parse --show-toplevel)'
alias please='sudo -EH $( history -p !! )'
alias drunbg='docker run --rm -d -v $PWD:$PWD -w $PWD'
alias drun='docker run --rm -it -v $PWD:$PWD -w $PWD'
alias dps='docker ps -a'
alias dim='docker images'
alias histfix='history -n && history | sort -k2 -k1nr | uniq -f1 | sort -n | cut -c8- > ~/.tmp$$ && history -c && history -r ~/.tmp$$ && history -w && rm ~/.tmp$$'
alias gout='go test -v -count=1 -coverprofile=cov.out ./...'
alias gocc='go tool cover -html=cov.out'
psgrep() {
ps aux | grep $@ | grep -v grep
}
cover() {
local t=$(mktemp -t cover)
go test -coverprofile=$t $@ \
&& go tool cover -func=$t \
&& unlink $t
}