-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaliases
95 lines (83 loc) · 1.96 KB
/
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# shortcuts
alias h="history"
alias ls="ls --color"
alias ll='ls -alh --color'
alias lt='ls -lthu --color'
alias ld="ls -lhd */"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias s='source'
alias mc='mc -b'
# tmux
alias ta='tmux attach -t'
alias tkill='tmux kill-session -t'
alias tls='tmux ls'
alias tmux='tmux -2'
alias tnew='tmux new -s'
#git
alias g="git"
alias ga="g a"
alias gc="g c"
alias gca="g ca"
alias gbr="g br"
alias gca="g ca"
alias gr="g reo"
alias gco="g co"
alias gcob="g cob"
alias gd="g d"
alias gdc="g dc"
alias gfo="g fo"
alias gfu="g fu"
alias gl="g l"
alias gll="g ll"
alias glll="g lll"
alias gpf="g pf"
alias gpo="g po"
alias gr="g r"
alias grom="g rom"
alias grum="g rum"
alias gs="g s"
# make
alias m='make'
# docker
alias d="docker"
alias dl="docker ps -l -q" # Get latest container ID
alias dps="docker ps" # Get container process
alias dpa="docker ps -a" # Get process included stop container
alias di="docker image ls" # Get images
alias drm="docker rm"
alias dex="docker exec -i -t" # Execute interactive container, e.g., $dex base /bin/bash
# python
alias pydoc2='python2 -m pydoc' # pydoc json
alias pydoc='python -m pydoc' # pydoc json
# go
godoc() {
go doc -all "$1" |less
}
# fkill - kill process
fkill() {
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
if [ "x$pid" != "x" ]
then
kill -${1:-9} $pid
fi
}
# fbr - checkout git branch
fbr() {
local branches branch
branches=$(git branch -vv) &&
branch=$(echo "$branches" | fzf +m) &&
git checkout $(echo "$branch" | awk '{print $1}' | sed "s/.* //")
}
# fshow - git commit browser
fshow() {
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \
--bind "ctrl-m:execute:
(grep -o '[a-f0-9]\{7\}' | head -1 |
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
{}
FZF-EOF"
}