sisyphus/config/zshrc

178 lines
5.3 KiB
Bash

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="mrfortem"
# Case-sensitive completion.
CASE_SENSITIVE="false"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"
# Auto-update behavior
zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# History timestamp format
HIST_STAMPS="dd/mm/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git dirhistory screen)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
use_color=true
if ${use_color} ; then
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
fi
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
alias hgrep='history | grep'
alias psql='psql -U postgres'
alias rmou='rclone mount OneDriveUGent: ~/Documents/OneDriveUGent/'
alias rmop='rclone mount OneDrivePersonal: ~/Documents/OneDrivePersonal'
alias helios='ssh tdpeuter@helios.ugent.be'
alias resblue='systemctl restart bluetooth'
alias Personal='cd ~/Documents/synchronisatie/Personal/_PERSOONLIJK/'
alias UGent='cd ~/Documents/synchronisatie/UGent/Informatica\ J1\ 2021-2022/'
alias vol='~/.scripts/vol.sh'
sshgit () {
# Check arguments
if [[ $# -lt 2 ]] ; then
echo "Requires at least two arguments"
exit 1
fi
ssh_key="$1"
shift
GIT_SSH_COMMAND="ssh -i ${ssh_key}" git $@
}
cpdir () {
# Check arguments
if [[ $# == 2 ]] ; then
from=$(dirname $1)
fromfile=$(basename $1)
to=$(dirname $2)
tofile=$(basename $2)
else
echo "cpdir: Not enough arguments"
echo "cpdir: Syntaxis: cpdir <source> <destination>"
return
fi
# Check file
if [[ ! -f $1 ]] ; then
echo "cpdir: Source does not exist: $1"
return
fi
echo "Move ${fromfile} from ${from} to ${to} as ${tofile}?"
echo -n "y/n > "
read answer
if [[ ${answer} == "y" ]] ; then
mkdir -pv $to
cp $1 $2
echo "Done"
elif [[ ${answer} == "n" ]] ; then
echo "Not copying..."
else
echo "Invalid option"
return
fi
}
#
# ex - arrchive extractor
# 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 ;;
*)
echo "'$1' cannot be extracted via ex()"
;;
esac
else
echo "'$1' is not a valid file"
fi
}