all repos — dotfiles @ ad26f7b39dc11e0239f2e116bdc4093d840e50ba

linux dotfiles

home/.bashrc (view raw)

 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
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
#
# ~/.bashrc
#
set -o vi


# If not running interactively, don't do anything
[[ $- != *i* ]] && return

[[ -f ~/.profile ]] && . ~/.profile

alias ls='ls --color=auto'

cd() {
	builtin cd "$@" && ls;
}

[[ -f /usr/share/bash-completion/bash_completion ]] && \
    . /usr/share/bash-completion/bash_completion

sman(){
    man `man -k . | fzf -i --reverse --height=40% --tiebreak=begin |\
        cut -d ' ' -f1`
}

# 'f'ind 'e'dit
fe(){
    vim "`fzf -i --reverse --height=40%`"
}

[[ -r "/usr/share/z/z.sh" ]] && source /usr/share/z/z.sh


# f - simply cd's into the dir beneath the current
f(){
    cd "$(dirname "$(fzf -i --reverse --height=40%)")"
}

# find from home and don't include *repos* in path
fh(){
    cd "$(dirname "$(find -H ~/* ! -path '*repos*' -type f | fzf -i --reverse --height=40% )")"
}

# find from home and edit
fhe(){
    vim "$(find -H ~/* ! -path '*repos*' -type f | fzf -i --reverse --height=40% )"
}

# find and open
fo(){
    rifle "$(fzf -i --reverse --height=40%)"
}

# cheat.sh
cheat(){
    curl -s cheat.sh/$1
}

inb(){
    if [ "$#" = "0" ]; then
        task next +in
    else
        task add +in "$@"
    fi
}

alias t="task"
alias o="rifle"

todo(){
    if [ $# -eq 0 ]; then
        task -in
    else
        task modify -in "$@"
    fi
}

alias es="vim +$ '+norm zz' $HOME/docs/org/snippets.md"
alias eb="vim $HOME/docs/org/bookmarks/index.md"
alias eo="vim $HOME/docs/org/"
alias en="vim $HOME/docs/org/2-notes/"
alias colemak="setxkbmap -layout 'us,in'  -variant colemak, -option 'grp:shifts_toggle'    -option 'ctrl:nocaps'"
alias qwerty="setxkbmap -layout 'us,in'   -option 'grp:shifts_toggle'    -option 'ctrl:nocaps'"
alias cfi="vim ~/.config/i3/config"
alias cfz="vim ~/.zshrc"
alias cfb="vim ~/.bashrc"
alias cfp="vim ~/.profile"
alias cfv="vim ~/.vimrc"
alias cfx="vim ~/.Xresources"
alias cfr="vim ~/.config/ranger/rifle.conf"
alias etf="vim ~/docs/org/todo.txt"
alias egc="vim ~/docs/org/growth-cal.txt"
alias rx="xrdb ~/.Xresources"
alias tmux="tmux -u"
alias ch="ping 8.8.8.8"
alias yv="youtube-viewer"
alias mkddir="mkdir `date +%d-%m-%Y`"
alias qn="vim ~/docs/org/0-inbox/\$(date +%Y-%m-%d-%H%M).md"
alias tt="transmission-remote"
# alias yw="mpv --ytdl-format=\"best[height<=480]\""
alias yw="mpv --ytdl-format=\"bestvideo[height<=480]+bestaudio/best[height<=480]\""
alias yal="mpv --ytdl-format=251"
alias tmuxl="tmux list-session"
alias rl="gpg --quiet -d ~/docs/org/lifelog/ll.gpg | sed 's/\t/ ā”‚ /' | less"
alias tb="nc termbin.com 9999"
alias tl="curl -s https://api.kraken.com/0/public/Ticker?pair=XBTUSD | jq -r '.result.XXBTZUSD.c[0]' | cut -d. -f1"
alias tf="terraform"
alias tg="terragrunt"
alias tss="timesheetctl s"
alias tse="timesheetctl e"
# generate a qrcode from contents of clipboard
alias qrclip="xsel -ob | qrencode -o - | feh --force-aliasing -Z -"
alias b="buku --suggest"
#alias lncli="lncli -n testnet"

alias gr="cd \`git rev-parse --show-toplevel\`"

#alias ls='ls'


#PS1='\[\033[34m\][\u@\h\[\033[01;00m\] \w\[\033[34m]\]\[\033[00m\]$ '
# āƈ (Right arrow)
# šŸž‚ (Right arrow shorter)
# šŸ”² (Right arrow shorter)
# āÆ (angle bracket)
# ā€ŗ (angle bracket)
_branch() {
    git rev-parse --abbrev-ref HEAD 2>/dev/null
}
_repo(){
    basename `git rev-parse --show-toplevel 2>/dev/null` 2>/dev/null
}

_repbra() {
    r=$(_repo)
    b=$(_branch)
    if [ "$r" -a "$b" ]
    then
        echo `_repo` ā€¢ `_branch`
    fi
}


PS1="\e[01;34m[\[\e[1;00m\]\w\[\e[01;34m\]]\[\e[01;00m\]\[\e[01;32m\] \$(_repbra) \[\e[01;00m\]\nšŸž‚ "
# PS1="\w\[\033[01;34m\]\[\033[01;00m\]\[\033[01;32m\]\$(git branch 2>/dev/null | grep '^*' | colrm 1 2 | sed 's/^/ (/' | sed 's/$/)/') \[\033[01;00m\]ā€ŗ "

# PS1='\[\033[01;32m\]ą„ [\[\033[37m\]\w\[\033[32m\]]\[\033[00m\] '
# PS1='\[\033[01;32m\]ā®ž [\[\033[37m\]\w\[\033[32m\]]\[\033[00m\] '
# PS1='\[\033[01;32m\]šŸ”² [\[\033[37m\]\w\[\033[32m\]]\[\033[00m\] '
#PS1='\[\033[01;32m\]ā— [\[\033[37m\]\w\[\033[32m\]]\[\033[00m\] '

[[ -f ~/bin/bash_prompt.sh ]] && . ~/bin/bash_prompt.sh

HISTCONTROL=ingoreboth
HISTSIZE=100000000
HISTFILESIZE=100000000
PROMPT_COMMAND='history -a'
HISTIGNORE='ls:bg:fg:history:cd:rm:gr'

slugen () {
    # generate a slug of alphabets
    dd if=/dev/urandom status=none bs=1024 count=1 | strings | tr -d '[:space:][:punct:][:digit:][Ilq]' | cut -c -${1:-4}
}
PROMPT_DIRTRIM=2

activate_nvm () {
    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
}

complete -C /usr/bin/terraform terraform
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

source /home/prithu/.config/broot/launcher/bash/br
# # Load pyenv automatically by appending
# # the following to
# # ~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
# # and ~/.bashrc (for interactive shells) :
#
# export PYENV_ROOT="$HOME/.pyenv"
# [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
# eval "$(pyenv init -)"
#
# # Restart your shell for the changes to take effect.
#
# This thing slows the prompt find out why. is the eval line?