#################################
#   Sherlock5512's Alias File   #
# This file is designed for zsh #
#                               #
#  these may not work for you   #
#    so try making your own     #
#################################

#Sherlock's Aliases for zsh
#Copyright © 2021 Robert Morrison

#Permission is hereby granted, free of charge, to any person obtaining
#a copy of this software and associated documentation files (the "Software"),
#to deal in the Software without restriction, including without limitation
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
#and/or sell copies of the Software, and to permit persons to whom the
#Software is furnished to do so, subject to the following conditions:

#The above copyright notice and this permission notice shall be included
#in all copies or substantial portions of the Software.

#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
#OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
#IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
#DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
#TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
#OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


###################
# Program Aliases #
###################

## Use Exa instead of ls
## REQUIRES NERD FONT
has exa && alias ls='exa --icons --group-directories-first'

## Shorten xdg-open
has xdg-open && alias xopen='xdg-open'

## cls Clear Screen run ls
alias cls='clear; ls'

## Shorten scriptedit
## REQUIRES scriptedit (Script)
has scriptedit && alias se='scriptedit'

## YouTube downloader
if has youtube-dl ; then
	alias yt='youtube-dl'
	alias yta='youtube-dl --ignore-config --add-metadata --ignore-errors --extract-audio --format "bestaudio/best"'
fi

##
alias cp='cp --interactive --verbose'
alias mv='mv --interactive --verbose'
alias rm='rm --interactive=once --verbose'
alias mkd='mkdir --parents --verbose'

## colourise commands
alias diff='diff --color=auto'
alias grep='grep --color=auto'
alias ip='ip --color=auto'

## Open Vimwiki
has nvim && alias vw='nvim -c VimwikiIndex'

## Change Wineprefix quick and EZ
has wineselect && alias ws='source wineselect'

## zero a terminal session
alias zero='dirs -c && clear'

#########################
# FileType Associations #
#   extension=program   #
#########################
if has nvim; then
	VIM=nvim
elif has vim; then
	VIM=vim
elif has vi; then
	VIM=vi
else
	VIM=''
fi

if [[ -n $VIM ]]; then
	alias -s tex=$VIM
	alias -s html=$VIM
	alias -s md=$VIM
fi
unset $VIM

has zathura && alias -s pdf=zathura


#  vim: set ft=zsh ts=2 sw=2 tw=0 noet :
