configs/.bashrc

95 lines
2.4 KiB
Bash
Raw Normal View History

2020-09-13 21:06:35 +02:00
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
2022-09-21 23:11:24 +02:00
# alias ls='ls --color=auto'
2020-09-13 21:06:35 +02:00
PS1='[\u@\h \W]\$ '
2023-08-18 22:53:44 +02:00
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
2020-09-13 21:06:35 +02:00
fi
2020-09-13 21:45:31 +02:00
### ARCHIVE EXTRATION
# usage: ex <file>
# found in https://gitlab.com/dwt1/dotfiles/-/blob/master/.bashrc
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
### ALIASES
# Some are inspired from https://gitlab.com/dwt1/dotfiles/-/blob/master/.bashrc
2020-09-14 22:50:23 +02:00
alias sudo='sudo '
2020-09-13 21:45:31 +02:00
# navigation
alias ..='cd ..'
alias ...='cd ../.'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
# vi = vim
alias vi='vim'
# package managers
alias upgrade='pacman -Suy && yay -Suy'
# git
alias add='git add'
alias branch='git branch'
2020-09-14 22:50:23 +02:00
alias commit='git commit -am'
2020-09-13 21:45:31 +02:00
alias clone='git clone'
alias pull='git pull'
alias push='git push'
alias merge='git merge'
alias status='git status'
alias rebase='git rebase'
2020-09-18 08:36:48 +02:00
alias chechkout='git checkout'
2020-09-13 21:45:31 +02:00
2023-08-18 22:53:44 +02:00
export EDITOR='vim'
2020-09-14 22:50:23 +02:00
2020-09-13 21:06:35 +02:00
alias config='/usr/bin/git --git-dir=/home/me/.cfg/ --work-tree=/home/me'
2022-09-16 09:51:24 +02:00
. "$HOME/.cargo/env"
2023-08-18 22:53:44 +02:00
# Pyenv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
alias cookiecutter='/home/me/bin/cookiecutter_venv/bin/cookiecutter'
source "$HOME/sources/bash_prompt"
export PATH="$HOME/bin:$PATH"
alias tmp='cd `mktemp -d`'
alias tvenv='TMP_ENV="$(mktemp -d)" && python -m venv "$TMP_ENV" && source "$TMP_ENV/bin/activate"'
alias scrap='wget -c -e robots=off -E -p -r -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" -np --convert-links --no-clobber --random-wait'
alias pysrv='python -m http.server -b 127.0.0.1 -d '