zsh/.aliases (view raw)
1#!/usr/bin/env bash
2
3alias gah='sudo $(fc -ln -1)'
4alias nvime="nvim ~/.config/nvim/init.vim"
5alias socks="ssh -D 8008 emerald -fN"
6alias o="xdg-open"
7alias gc="git commit -v -s"
8alias gst="git status --short"
9alias ga="git add"
10alias gd="git diff --minimal"
11alias gl="git log --oneline --decorate --graph"
12alias ls="ls --color"
13alias vim="nvim"
14
15function up {
16 ~/bin/icyup.sh "$1"
17}
18
19function nvmon {
20 source ~/.nvm/nvm.sh
21}
22
23function envac {
24 source .env/bin/activate
25}
26
27function vpn {
28 ~/bin/vpnon.sh
29}
30
31function f() {
32 fff "$@"
33 cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")"
34}
35
36function git_branch() {
37 local git_status="$(git status 2> /dev/null)"
38 local on_branch="On branch ([^${IFS}]*)"
39 local on_commit="HEAD detached at ([^${IFS}]*)"
40
41 if [[ $git_status =~ $on_branch ]]; then
42 local branch=${BASH_REMATCH[1]}
43 echo -ne "───${grn} $branch ${rst}"
44 elif [[ $git_status =~ $on_commit ]]; then
45 local commit=${BASH_REMATCH[1]}
46 echo -ne "───${ylw} $commit ${rst}"
47 fi
48}