124 lines
3.1 KiB
Bash
124 lines
3.1 KiB
Bash
#
|
|
# ~/.bashrc
|
|
#
|
|
|
|
# If not running interactively, don't do anything
|
|
[[ $- != *i* ]] && return
|
|
|
|
alias ls='ls --color=auto'
|
|
PS1='[\u@\h \W]\$ '
|
|
|
|
### ALIAS' ###
|
|
#jokes
|
|
alias dog='cat'
|
|
alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash' #rickroll
|
|
|
|
# navigation
|
|
alias ..='cd ..'
|
|
alias ...='cd ../..'
|
|
alias .3='cd ../../..'
|
|
alias .4='cd ../../../..'
|
|
alias .5='cd ../../../../..'
|
|
|
|
#libreoffice
|
|
alias writer='libreoffice --writer'
|
|
alias calc='libreoffice --calc'
|
|
alias impress='libreoffice --impress'
|
|
|
|
# pacman and pikaur
|
|
alias update='sudo pacman -Syyu' # update only standard pkgs
|
|
alias update-all="pikaur -Syu" # update standard pkgs and AUR pkgs
|
|
alias cleanup='sudo pacman -Rns $(pacman -Qtdq)' # remove orphaned packages
|
|
|
|
# Changing "ls" to "exa"
|
|
alias ls='exa -l --color=always --group-directories-first' # my preferred listing
|
|
alias la='exa -a --color=always --group-directories-first' # all files and dirs
|
|
alias ll='exa -al --color=always --group-directories-first' # long format
|
|
alias lt='exa -aT --color=always --group-directories-first' # tree listing
|
|
alias l.='exa -a | egrep "^\."'
|
|
|
|
# Colorize grep output (good for log files)
|
|
alias grep='grep --color=auto'
|
|
alias egrep='egrep --color=auto'
|
|
alias fgrep='fgrep --color=auto'
|
|
|
|
# confirm before overwriting something
|
|
alias cp="cp -i"
|
|
alias mv='mv -i'
|
|
alias rm='rm -i'
|
|
|
|
# git
|
|
alias add='git add'
|
|
alias addup='git add -u'
|
|
alias addall='git add .'
|
|
alias branch='git branch'
|
|
alias checkout='git checkout'
|
|
alias clone='git clone'
|
|
alias commit='git commit -m'
|
|
alias fetch='git fetch'
|
|
alias pull='git pull origin'
|
|
alias push='git push origin'
|
|
alias status='git status'
|
|
|
|
|
|
### AUTOSTART ###
|
|
# >>> neofetch >>>
|
|
neofetch
|
|
# <<< neofetch <<<
|
|
|
|
# >>> powerline >>>
|
|
function _update_ps1() {
|
|
PS1=$(powerline-shell $?)
|
|
}
|
|
if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
|
|
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
|
fi
|
|
# <<< powerline <<<
|
|
|
|
# >>> conda initialize >>>
|
|
# !! Contents within this block are managed by 'conda init' !!
|
|
__conda_setup="$('/home/paul/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
|
if [ $? -eq 0 ]; then
|
|
eval "$__conda_setup"
|
|
else
|
|
if [ -f "/home/paul/anaconda3/etc/profile.d/conda.sh" ]; then
|
|
. "/home/paul/anaconda3/etc/profile.d/conda.sh"
|
|
else
|
|
export PATH="/home/paul/anaconda3/bin:$PATH"
|
|
fi
|
|
fi
|
|
unset __conda_setup
|
|
# <<< conda initialize <<<
|
|
|
|
|
|
### FUNCTIONS ###
|
|
# >>> Archive extraction >>>
|
|
# usage: ex <file>
|
|
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
|
|
}
|
|
# <<< Archive extraction <<<
|
|
|
|
|