forked from eyesmd/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
37 lines (32 loc) · 1.12 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
#!/bin/bash
# General
alias st='subl'
alias cl='clear'
alias l='ls'
alias ..='cd ..'
alias c='compile'
alias k='kubectl'
# Application Arguments
alias tmux='tmux -2' # force 256 colors
alias ll='ls -alh'
alias la='ls -a'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Handy
alias o='xdg-open'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
function gch() {
git branch --sort=-committerdate -r --format "%(refname:short)" | grep -v "origin/HEAD" | awk -F/ '{ st = index($0,"/");print substr($0,st+1)}' | tr -d ' ' | fzf --layout=reverse --color=light --preview='git log {} --color' --query="$1" | xargs git checkout
}
alias mrc='git rev-parse HEAD | cut -c1-7'
# kc as in kube-context
function kc() {
if [ -z "$1" ]; then
CONTEXT=$(kubectl config get-contexts --output=name | fzf)
else
CONTEXT=$(kubectl config get-contexts --output=name | fzf --filter "$1" | tail -n1)
fi
kubectl config use-context $CONTEXT
}