forked from hugojosefson/ubuntu-install-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_aliases
100 lines (80 loc) · 1.83 KB
/
.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
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
96
97
98
99
100
# vi:syntax=bash
# .bash_aliases
alias ba='vim ~/.bash_aliases'
alias .ba='. ~/.bash_aliases'
# node
alias nn='nodeversion=$(cat package.json | jq -r .engines.node); nvm install $nodeversion'
# tmuxinator
alias mux=tmuxinator
alias m=mux
alias mm='mux mux'
_tmuxinator() {
COMPREPLY=()
local word
word="${COMP_WORDS[COMP_CWORD]}"
if [ "$COMP_CWORD" -eq 1 ]; then
local commands="$(compgen -W "$(tmuxinator commands)" -- "$word")"
local projects="$(compgen -W "$(tmuxinator completions start)" -- "$word")"
COMPREPLY=( $commands $projects )
elif [ "$COMP_CWORD" -eq 2 ]; then
local words
words=("${COMP_WORDS[@]}")
unset words[0]
unset words[$COMP_CWORD]
local completions
completions=$(tmuxinator completions "${words[@]}")
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
fi
}
complete -F _tmuxinator m
# Make
alias mp='make package'
# Git
. /usr/share/bash-completion/completions/git
alias gk='gitk --all &>/dev/null &'
__git_complete g __git_main
function g() {
local cmd=${1-status}
shift
git $cmd "$@"
}
__git_complete gf _git_fetch
function gf() {
git fetch --all --prune "$@"
}
__git_complete gc _git_commit
function gc() {
git commit "$@"
}
function gg() {
git commit -m "$*"
}
__git_complete gd _git_diff
function gd() {
git diff "$@"
}
__git_complete ga _git_add
function ga() {
git add --all "$@"
}
__git_complete gp _git_push
function gp() {
git push "$@"
}
__git_complete gpl _git_pull
function gpl() {
git pull "$@"
}
# Docker
function d() {
local cmd=${1-ps}
shift
docker $cmd "$@"
}
# npm
which npm > /dev/null && . <(npm completion)
# pbcopy / pbpaste
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
# temp directory
alias t='cd $(mktemp -d)'