nix/.bashrc

63 lines
2.9 KiB
Bash
Raw Normal View History

2021-01-02 01:31:52 +00:00
if [ -e /Users/evanreichard/.nix-profile/etc/profile.d/nix.sh ]; then . /Users/evanreichard/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
# ------------------------------------------------------------------------------
# ---------------------------------- VI MODE -----------------------------------
# ------------------------------------------------------------------------------
set -o vi
2020-10-22 14:30:03 +00:00
# ------------------------------------------------------------------------------
# ---------------------------------- ALIASES -----------------------------------
# ------------------------------------------------------------------------------
alias vi="/Applications/MacVim.app/Contents/bin/mvim -v"
2021-01-02 01:31:52 +00:00
alias vim="/Applications/MacVim.app/Contents/bin/mvim -v"
alias grep="grep --color"
2019-02-07 16:00:51 +00:00
alias urldecode='python -c "import sys, urllib as ul; \
print ul.unquote_plus(sys.argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; \
print ul.quote_plus(sys.argv[1])"'
2020-10-22 14:30:03 +00:00
# ------------------------------------------------------------------------------
# --------------------------------- FUNCTIONS ----------------------------------
# ------------------------------------------------------------------------------
function cache {
cmd="$*"
name=$(echo "$PWD-$cmd" | base64)
if [[ -f ~/.bash-cache/$name.exit ]] && [[ $(cat ~/.bash-cache/$name.exit) -eq 0 ]]; then
printf "CACHED:\n\n"
else
mkdir -p ~/.bash-cache
eval "$cmd" > ~/.bash-cache/$name.out
echo $? > ~/.bash-cache/$name.exit
fi
cat ~/.bash-cache/$name.out
}
2021-01-02 01:31:52 +00:00
2019-02-07 16:00:51 +00:00
function sfind(){
find . -name "$1" -print0 | xargs -0 grep "$2"
}
2021-01-02 01:31:52 +00:00
2019-02-07 16:00:51 +00:00
function csv2mdt(){
cat $1 | sed 1p | LC_ALL=C sed -e 's/,/ |\&nbsp\;\&nbsp\; /g' -e 's/^/| /g' -e 's/$/ |/g' -e '2 s/[^|]/-/g' | LC_ALL=C tr -d $'\r'
}
2020-10-22 14:30:03 +00:00
# ------------------------------------------------------------------------------
# ---------------------------------- EXPORTS -----------------------------------
# ------------------------------------------------------------------------------
2021-01-02 01:31:52 +00:00
export PATH=$HOME/.local/bin:$PATH
2020-10-22 14:30:03 +00:00
export KUBE_EDITOR="/Applications/MacVim.app/Contents/bin/mvim -v"
2021-01-02 01:31:52 +00:00
export NIX_PYTHONPATH=$(python3 -c "import sys; print(sys.base_prefix)")
2019-05-29 18:19:30 +00:00
2020-10-22 14:30:03 +00:00
# ------------------------------------------------------------------------------
# --------------------------------- POWERLINE ----------------------------------
# ------------------------------------------------------------------------------
2019-05-29 18:19:30 +00:00
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
2021-01-02 01:31:52 +00:00
. $HOME/.local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh
2019-05-29 18:19:30 +00:00
2020-10-22 14:30:03 +00:00
# ------------------------------------------------------------------------------
# ------------------------------ TMUX & NEOFETCH -------------------------------
# ------------------------------------------------------------------------------
2019-02-07 16:00:51 +00:00
[ ! -z $TMUX ] || tmux a || tmux
neofetch