Initial commit

This commit is contained in:
Robert Morrison 2021-08-30 04:19:39 +01:00
commit bf2f207b59
Signed by: robert
GPG Key ID: 73E012EB3F4EC696
11 changed files with 2312 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "ZshPlug"]
path = ZshPlug
url = https://git.closedless.xyz/robert/ZshPlug

2052
.zcompdump Normal file

File diff suppressed because it is too large Load Diff

1
.zshrc Symbolic link
View File

@ -0,0 +1 @@
zshrc

1
ZshPlug Submodule

@ -0,0 +1 @@
Subproject commit c11688deafea862d1cc4cde4376f0534f54c28b7

75
aliases Executable file
View File

@ -0,0 +1,75 @@
#################################
# 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
alias ls='exa --icons --group-directories-first'
## Shorten xdg-open
alias xopen='xdg-open'
## cls Clear Screen run ls
alias cls='clear; ls'
## Shorten scriptedit
## REQUIRES scriptedit (Script)
alias se='scriptedit'
## YouTube downloader
alias yt='youtube-dl'
alias yta='youtube-dl --ignore-config --add-metadata --ignore-errors --extract-audio --format "bestaudio/best"'
##
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'
#########################
# FileType Associations #
# extension=program #
#########################
alias -s tex=nvim
alias -s html=nvim
alias -s pdf=zathura
alias -s md=nvim
# vim: set ft=zsh ts=2 sw=2 tw=0 noet :

8
dir_aliases Executable file
View File

@ -0,0 +1,8 @@
############################
# Alias Common Directories #
############################
alias -g DX='$HOME/Documents'
alias -g DL='$HOME/Downloads'
alias -g CN='${XDG_CONFIG_HOME:-$HOME/.config}'

25
functions/exit Executable file
View File

@ -0,0 +1,25 @@
##############################
# tmp directory cleanup code #
# now functionified #
# empties ~/tmp #
# unless KEEPTMP exists #
##############################
function CleanTmp() {
## exit if no tmp folder
[ ! -d "$HOME/tmp" ] && return
## exit if KEEPTMP
[ -f "$HOME/tmp/KEEPTMP" ] && return
## remove tmp
## Pipe all output to file
rm -rvf $HOME/tmp/* > ~/.cleanupResult 2>&1
## remove result if cleanup successful
status=$?
[ $status -eq 0 ] && rm ~/.cleanupResult
echo "cleaned tmp"
}

19
greet Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
colours.sh
echo '╭───────────╮'
echo '│ Welcome!! │'
echo '╰───────────╯'
date
if [ -d "$HOME/tmp" ]; then
if [ -f "$HOME/tmp/KEEPTMP" ] || [ -f "$HOME/.cleanupResult" ]; then
printf "\033[31m\e[1m\e[5mYou have files in your tmp directory\e[0m"
exa -alhT ~/tmp || tree ~/tmp
if [ -f "$HOME/.cleanupResult" ]; then
echo "ISSUE WAS:"
cat "$HOME/.cleanupResult"
fi
fi
fi
randomVerse
colours.sh

22
keyboard Executable file
View File

@ -0,0 +1,22 @@
## Use zkbd to set automagical keybinkds
## this can fix terminals that have different outputs for keys than expoected
autoload -Uz zkbd
if [[ -f $HOME/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE} ]]; then
source $HOME/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE}
else
echo "WARNING: Keybindingd may not be set correctly!"
echo "Execute \`zkbd\` to create bindings."
fi
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Backspace]}" ]] && bindkey "${key[Backspace]}" backward-delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-search
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char

33
prompt Executable file
View File

@ -0,0 +1,33 @@
####################
# Sherlocks Prompt #
####################
setopt prompt_subst ## Enable prompt Substitution
## Load vcs_info module
autoload -Uz vcs_info
## Enable git tracking
zstyle ':vcs_info:*' enable git
## Set icons for Staged and Unstaged Changes
zstyle ':vcs_info:git*' stagedstr "✅"
zstyle ':vcs_info:git*' unstagedstr "⛔"
## Enable check for changes (CPU-intensive)
## DISABLE THIS ON LOW POWER SYSTEMS
zstyle ':vcs_info:git*' check-for-changes true
## Set format for Repo Information
zstyle ':vcs_info:git*' formats "-(%s:שׂ %b %u%c)"
## set precmd to get vcs_info
## precmd runs before every prompt
precmd() {
vcs_info
}
PROMPT="$(setTermTitle "(%n@%m %~)")╭╼(%{%F{81}%}%n%{%F{245}%}@%{%F{206}%}%m %{%F{245}%}%~%{%F{259}%})─(%(?.😎.😞 %?))"$'\n'"╰┤"
RPROMPT='${vcs_info_msg_0_}'
# vim: set ft=zsh ts=2 sw=2 tw=0 noet :

73
zshrc Executable file
View File

@ -0,0 +1,73 @@
#############################
# Sherlock's ZSHRC #
# This may not work for you #
# Try making your own #
#############################
## Unalias Defaults that I am going to change later
unalias run-help
## autoload Modules
autoload -U +X colors && colors
autoload -U calendar
autoload -U run-help
autoload -U +X compinit
autoload -U edit-command-line
## zmodload Modules
zmodload zsh/complist
## Source Other files
source $HOME/.profile
source ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/aliases
source ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/dir_aliases
source ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/prompt
source ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/keyboard
## Source Functions
source ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/functions/*
## Set option
setopt emacs ## Emacs style keybinds
setopt autocd ## Change to directory if given as command
setopt autopushd ## Automatically use pushd and stack
setopt correct ## Pick up on Spelling errors
setopt SHARE_HISTORY ## Share history across sessions
setopt hist_verify ## Edit Commands after expansion
## Configure History File
export HISTSIZE=10000
export SAVEHIST=$HISTSIZE
export HISTFILE=$HOME/.zhistory
## Configure Completions
zstyle ':completion:*' menu select ## use menu to select where possible
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' ## better descriptions format
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b' ## show when no matches
zstyle ':completion:*' completer _complete _match _approximate ## fuzzy match
zstyle ':completion:*:match:*' original only
zstyle -e ':completion:*:approximate:*' \
max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' ## more errors in longer lines
zstyle ':completion:*:functions' ignored-patterns '_*' ## ignore completions for commands I dont have
zstyle ':completion:*' squeeze-slashes true ## remove trailing slashes
zstyle ':completion:*:cd:*' ignore-parents parent pwd ## don't complete parent dir
compinit
_comp_options+=(globdots)
## Configure command line editor
zle -N edit-command-line
bindkey "" edit-command-line
## Configure Plugins
export ZSH_AUTOSUGGEST_STRATEGY=(completion history) # suggest from completion then history
export ZSH_AUTOSUGGEST_USE_ASYNC=1 # make async for SPEED
export ZSH_AUTOSUGGEST_HISTORY_IGNORE='(cd|cp|tar|mv|ls|nvim|rm|rmdir|git) *'
## Load Plugins with ZshPlug
export ZSH_PLUG_plugins=( "zsh-users/zsh-autosuggestions" "zdharma/fast-syntax-highlighting" "MichaelAquilina/zsh-you-should-use" )
source $ZDOTDIR/ZshPlug/ZshPlug.zsh
$ZDOTDIR/greet