Update dotfiles

This commit is contained in:
ItsDrike 2021-01-14 13:38:43 +01:00
parent 0a7d4c700d
commit 6e2557cc86
6 changed files with 326 additions and 182 deletions

View file

@ -1,32 +1,29 @@
#!/usr/bin/env bash
# enable color support
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias cgrep='grep --color=always'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# I'm not the greatest typist
alias sl='ls'
alias mdkir='mkdir'
alias soruce='source'
alias souce='source'
# Exa aliases (replacement for ls, if you are using ls, comment or change this
alias ls='exa'
alias ll='exa -glah'
alias l='exa -glah'
alias ll='exa -glah --classify -s=size --group-directories-first -r'
alias ld='exa -glahD'
alias lt='exa -Tlagh'
alias tree='exa -T'
alias tree='exa -Tlagh'
alias dotfiles='exa -hula -d .[a-z]* | grep -v ^d' # Show all dotfiles
alias dotdirs='exa -hulaD -d .[a-z]*' # Show all dotdirs
alias dotall='exa -hula -d .[a-z]*' # Show both dotdirs and dotfiles
# Shortcuts
alias vi='vim'
alias rr='rm -r'
alias sv='systemctl'
# Aliases for piping directly (f.e.: history G ssh)
alias -g G='| grep'
alias -g H='| head'
# Changing directories
alias ..='cd ..'
alias ...='cd ../../'
@ -48,39 +45,116 @@ alias bpy='bpython'
alias cfzshrc='vim ~/.zshrc'
alias cfvim='vim ~/.config/vim/vimrc'
alias cfalias='vim ~/.config/sh/aliases'
alias cffunctions='vim ~/.config/sh/functions'
alias cfenviron='vim ~/.config/sh/environ'
alias cfhandlers='vim ~/.config/sh/handlers'
# Replacements
alias wget='wget -c' # Resume wget by default
alias du='du -ach | sort -h' # Sort du by size
alias df='df -H' # Show sizes as powers of 1000
alias mkdir='mkdir -p' # Mkdir with automatic creation of parent directories
alias ps='ps auxf' # Print all processes
alias tty-clock='tty-clock -Ssc' # Terminal clock screensaver
alias vi='vim' # Nobody uses `vi` anymore, go directly to `vim`
# Fallbacks
command -v hd > /dev/null || alias hd="hexdump -C" # Cannonical hex dump; some systems have this symlinked
command -v md5sum > /dev/null || alias md5sum="md5" # Fallback from `md5sum` to `md5`
command -v sha1sum > /dev/null || alias sha1sum="shasum" # Fallback from `sha1sum` to `shasum`
# Regular expressions
alias reg_email='echo "[^[:space:]]+@[^[:space:]]+"'
alias reg_mac='echo "([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'
alias reg_ipv4='echo "([0-9]{1,3}\.){3}[0-9]{1,3}"'
alias reg_ipv6='echo "\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*"' # Also catches loopbacks (::1), (for valid matching, it needs to be this long...)
alias reg_ip='echo "(`reg_ipv4`|`reg_ipv6`)"' # Match both IPv4 and IPv6
# Custom aliases
alias reload="exec \$SHELL" # Reload the shell (i.e. invoke as a login shell
alias ip-show="dig +short myip.opendns.com @resolver1.opendns.com" # Gets your IP address
alias fhere='find . -name' # Find file/dir from currrent dir
alias grep_email='grep -E `reg_email`'
alias grep_ip='grep -E `reg_ip`'
alias grep_mac='grep -E `reg_mac`'
# Validate things
alias yamlcheck='python -c "import sys, yaml as y; y.safe_load(open(sys.argv[1]))"'
alias jsoncheck='jq "." >/dev/null <'
# IPTables (firewall) aliases
alias ipt='sudo iptables' # Shortcut
alias iptlist='sudo iptables -L -n -v --line-numbers' # All rules
alias iptlistin='sudo iptables -L INPUT -n -v --line-numbers' # IN rules
alias iptlistout='sudo iptables -L OUTPUT -n -v --line-numbers' # OUT rules
alias iptlistfw='sudo iptables -L FORWARD -n -v --line-numbers' # FORWARD rules
alias firewall=iptlist
# Network
alias ip-show='curl https://ipinfo.io/ip' # Show public IP address
alias ip-info='curl https://ipinfo.io/json' # Show public IP info (IP,region,country,timezone,...)
alias ips="ifconfig -a | grep -oE \"inet6? (addr:)?s?\`reg_ip\`\" | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
alias local-devices='nmap -T5 -sP 192.168.0.0-255'
alias ports='netstat -tulanp'
alias listening-ports='netstat -vtlnp --listening'
alias ssh-list='ss | grep ssh' # List all SSH connections
alias swapout='sudo swapoff -a; sudo swapon -a' # Reset swap (move everything to RAM)
alias cpu-stress='fulload() { dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null & }; fulload; read; killall dd'
alias psg='\ps aux | grep -v grep | grep -i -e VSZ -e' # Get searchable process with nice output
alias path='echo -e ${PATH//:/\\n}' # Print each PATH entry on a separate line
alias colors-256='curl -s https://gist.githubusercontent.com/HaleTom/89ffe32783f89f403bba96bd7bcd1263/raw/ | bash' # Show color table
alias mount-table='df' # Show list of all mounted devices and their mount locations
alias create_mirror_list='reflector --country Slovakia --country Czechia --country Poland --country Hungary --country Ukraine --country Germany --country US --latest 800 --protocol https --sort rate --save mirrorlist'
alias pacman-extract='pacman -Syw --cachedir .' # Extract package/es into current floders
alias clean='rm -rf ~/.local/share/Trash/* && rm -rf ~/Downloads/*' # Remove trash and downloads files
alias serve='python -m http.server' # Serve current directorty as HTTP
alias serve-public='python -m http.server --bind 192.168.0.102' # Serve publically
# System info
alias meminfo='free -m -l -t'
alias cpuinfo='lscpu'
alias batinfo='sudo watch -d -n 2 tlp-stat -b'
alias gpumeminfo='frep -i --color memory /var/log/Xorg.0.log'
alias distro="cat /etc/*-release"
# Processes
alias psmem='ps auxf | sort -nr -k 4' # Top memory eaters
alias pscpu='ps auxf | sort -nr -k 3' # Top cpu eaters
alias psg='ps aux | grep -v grep | grep -i -e VSZ -e' # Get searchable process with nice output
# Time info
alias now='date +"%T"'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'
alias week='date +%V'
# Git aliases
alias g='git'
alias gs='git status'
alias gc='git commit'
alias gcm='git commit -m'
alias ga='git add'
alias gaa='git add all'
alias gb='git branch'
alias gcb='git checkout -b'
alias gcda='git diff --cached' # Diff any files staged for commit
alias gf='git fetch'
alias gm='git merge'
alias gp='git push'
alias glog='git log --oneline --decorate --graph'
alias gundo='git reset HEAD~'
alias gredo="git reset 'HEAD@{1}'"
alias undopush="git push -f origin HEAD^:master"
# Other headless aliases
alias reload="exec \$SHELL" # Reload the shell (i.e. invoke as a login shell
alias path='echo -e ${PATH//:/\\n}' # Print each PATH entry on a separate line
alias fhere='find . -name' # Find file/dir from currrent dir
alias swapout='sudo swapoff -a; sudo swapon -a' # Reset swap (move everything to RAM)
alias diskspace_report="df -P -kHl"
alias mount-table='df' # Show list of all mounted devices and their mount locations
alias pacman-extract='pacman -Syw --cachedir .' # Extract package/es into current floders
alias mount-ram='mount -t tmpfs tmpfs' # Mount RAM disk for fast filesystem
alias ubu-key='gpg --keyserver keyserver.ubuntu.com --recv-key'
alias colors-256='curl -s https://gist.githubusercontent.com/HaleTom/89ffe32783f89f403bba96bd7bcd1263/raw/ | bash' # Show color table
alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"' # Encode strings as URLs (space->%20, etc.)
alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.pdf' # Usage: `mergepdf input{1,2,3}.pdf`
alias create_mirror_list='reflector --country Slovakia --country Czechia --country Poland --country Hungary --country Ukraine --country Germany --country US --latest 800 --protocol https --sort rate --save mirrorlist'
alias cpu-stress='fulload() { dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null & }; fulload; read; killall dd'
# Graphical custom aliases
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias nvidia='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia' # Run app with nvidia (on hybrid mode with optimus)
alias o='dolphin .' # open in dolphin (file manager)
alias batinfo='sudo watch -d -n 2 tlp-stat -b'
alias sound_control='alsamixer' # Sound control tool in alsa_utils package
alias firefox="GTK_USE_PORTAL=1 firefox"
alias firefox='GTK_USE_PORTAL=1 firefox'
alias pdf-reader='mupdf' # Open pdf file
alias md-to-pdf='pandoc -s -o' # Convert markdown to pdf
alias minecraft='minecraft-launcher'
alias metasploit='msfconsole'
# If user is not root, pass all commands via sudo
@ -95,6 +169,18 @@ if [ $UID -ne 0 ]; then
alias unsudo='sudo -k' # Reset sudo timeout (sudo will require password)
fi
# enable color support
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias cgrep='grep --color=always'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Normalize `open` across Linux, macOS, and Windows.
# This is needed to make `open` function (see below) cross-platform
if [ ! $(uname -s) = 'Darwin' ]; then

45
home/.config/sh/environ Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Environmental variables
export EDITOR=vim
export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv
export LESS_TERMCAP_md="${yellow}" # Highlight section titles in manual pages
export BASH_SILENCE_DEPRECATION_WARNING=1 # Hide the “default interactive shell is now zsh” warning on macOS.
# Add executable directories into PATH
PATH+=":$HOME/.local/bin"
# XDG Standard paths
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
# Per-Application ENV setting
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export LESSHISTFILE="-"
export VIMINIT=":source $XDG_CONFIG_HOME/vim/vimrc"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export KDEHOME="$XDG_CONFIG_HOME/kde"
export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export TS3_CONFIG_DIR="$XDG_CONFIG_HOME/ts3client"
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
export PYLINTHOME="$XDG_CACHE_HOME/pylint"
export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
export GOPATH="$XDG_DATA_HOME/go"
export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
export PYTHON_EGG_CACHE="$XDG_CACHE_HOME/python-eggs"
export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter"
export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history"
export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history"
export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"
export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer"
# XDG Alias overrides
alias nvidia-settings='nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings"'
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'

6
home/.config/sh/extra Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
export XMR_ADDRESS="45vtSq96QPjf5hvtHyR5Za7zAnCscHjvnPtCiBmB7BZtBVni3EfT8XeEYWfBxCPCpkR6HJL9iQdJE1BeBhKmUVMTV5Bp4an"
alias backup-x="rsync -av /home/itsdrike/Personal/Other/X /run/media/itsdrike/dc32bd7d-3ad4-45b0-a495-b99907a23de9/"
alias xmrmine="xmrig -o pool.minexmr.com:443 -u $XMR_ADDRESS -k --tls --rig-id Telcast"

View file

@ -1,5 +1,117 @@
#!/usr/bin/env bash
# Show application listening on given port
function port() {
sudo netstat -pln | grep $1 | awk '{print $NF}'
}
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
}
# `o` with no arguments opens the current directory, otherwise opens the given
# location
function o() {
if [ $# -eq 0 ]; then
open .;
else
open "$@";
fi;
}
# Determine size of a file or total size of a directory
function dir-size() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
\du $arg -- "$@";
else
\du $arg .[^.]* ./*;
fi;
}
# Go to the root of a git tree
cdgit () {
git rev-parse --is-inside-work-tree > /dev/null 2>&1
if [ $? -eq 0 ]; then
TEMP_PWD=`pwd`
while ! [ -d .git ]; do
cd ..
done
return 0
else
echo "Not a git directory"
return 1
fi
}
# Create a data URL from a file
function dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
tree -I '.git|node_modules|bower_components' --group-directories-first "$@" | less -FRNX;
}
# Show all the names (CNs and SANs) listed in the SSL certificate
# for a given domain
function getcertnames() {
if [ -z "${1}" ]; then
echo "ERROR: No domain specified.";
return 1;
fi;
local domain="${1}";
echo "Testing ${domain}…";
echo ""; # newline
local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1);
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
local certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
no_serial, no_sigdump, no_signame, no_validity, no_version");
echo "Common Name:";
echo ""; # newline
echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
echo ""; # newline
echo "Subject Alternative Name(s):";
echo ""; # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
| sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
return 0;
else
echo "ERROR: Certificate not found.";
return 1;
fi;
}
# Compare original and gzipped file size
function gz-compare() {
local origsize=$(wc -c < "$1");
local gzipsize=$(gzip -c "$1" | wc -c);
local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l);
printf "orig: %d bytes\n" "$origsize";
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio";
}
# Extract almost any archive
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
@ -36,11 +148,6 @@ function extract {
fi
}
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
}
# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
function targz() {
local tmpFile="${@%/}.tar";
@ -74,96 +181,3 @@ function targz() {
echo "${tmpFile}.gz ($((zippedSize / 1000)) kB) created successfully.";
}
# Determine size of a file or total size of a directory
function dir-size() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
\du $arg -- "$@";
else
\du $arg .[^.]* ./*;
fi;
}
# Use Gits colored diff when available
hash git &>/dev/null;
if [ $? -eq 0 ]; then
function diff() {
git diff --no-index --color-words "$@";
}
fi;
# Create a data URL from a file
function dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}
# Compare original and gzipped file size
function gz() {
local origsize=$(wc -c < "$1");
local gzipsize=$(gzip -c "$1" | wc -c);
local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l);
printf "orig: %d bytes\n" "$origsize";
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio";
}
# Show all the names (CNs and SANs) listed in the SSL certificate
# for a given domain
function getcertnames() {
if [ -z "${1}" ]; then
echo "ERROR: No domain specified.";
return 1;
fi;
local domain="${1}";
echo "Testing ${domain}…";
echo ""; # newline
local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1);
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
local certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
no_serial, no_sigdump, no_signame, no_validity, no_version");
echo "Common Name:";
echo ""; # newline
echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
echo ""; # newline
echo "Subject Alternative Name(s):";
echo ""; # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
| sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
return 0;
else
echo "ERROR: Certificate not found.";
return 1;
fi;
}
# `o` with no arguments opens the current directory, otherwise opens the given
# location
function o() {
if [ $# -eq 0 ]; then
open .;
else
open "$@";
fi;
}
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
}

24
home/.config/sh/handlers Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Command not found hook that uses `pkgfile` package
# to search through the package database in order to
# find a package which includes given command, which
# was resolved as not found, if there are no such packages
# only print command not found message
command_not_found_handler() {
local pkgs cmd="$1" files=()
printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages
files=(${(f)"$(pkgfile ${cmd})"})
if (( ${#files[@]} )); then
printf '\r%s may be found in the following packages:\n' "$cmd"
local res=() repo package version file
for file in "$files[@]"; do
res=("${(0)file}")
repo="$res[1]"
printf ' %s\n' "$repo"
done
else
printf '\n'
fi
return 127
}

View file

@ -1,32 +1,24 @@
# ZSH Cache config
ZSH_CACHE="$HOME/.cache/zsh"
# History in cache directory
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=$ZSH_CACHE/history
export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION"
# Move .zsh-update to $ZSH_CACHE
[ -f ~/.zsh-update ] && mv ~/.zsh-update $ZSH_CACHE/.zsh-update
export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION"
# ZSH History config
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=$ZSH_CACHE/history
setopt appendhistory
# Export oh-my-zsh location as $ZSH
# oh-my-zsh configuration
export ZSH="/usr/share/oh-my-zsh"
# Set theme
ZSH_THEME="af-magic"
# How often should zsh be updated
export UPDATE_ZSH_DAYS=5
# Enable command auto-correction
UPDATE_ZSH_DAYS=5
ENABLE_CORRECTION="false"
# Run oh-my-zsh
source $ZSH/oh-my-zsh.sh
# Enable colors
autoload -U colors && colors
@ -37,44 +29,21 @@ zmodload zsh/complist
compinit -d $ZSH_COMPDUMP
comp_options+=(globdots)
# Environmental variable exports, including XDG standard definitions
[ -f ~/.config/sh/environ ] && source ~/.config/sh/environ
# Setup aliases
[ -f ~/.config/sh/aliases ] && source ~/.config/sh/aliases
# XDG Exports
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
# Load handlers
[ -f ~/.config/sh/handlers ] && source ~/.config/sh/handlers
# ~/ Clean-up
export WGETRC="$XDG_CONFIG_HOME"/wget/wgetrc
export LESSHISTFILE="-"
export VIMINIT=":source $XDG_CONFIG_HOME"/vim/vimrc
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
export KDEHOME="$XDG_CONFIG_HOME"/kde
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
export TS3_CONFIG_DIR="$XDG_CONFIG_HOME"/ts3client
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
export PYLINTHOME="$XDG_CACHE_HOME"/pylint
export SQLITE_HISTORY=$XDG_DATA_HOME/sqlite_history
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
export GOPATH="$XDG_DATA_HOME"/go
export IPYTHONDIR="$XDG_CONFIG_HOME"/ipython
export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME"/jupyter
export MYSQL_HISTFILE="$XDG_DATA_HOME"/mysql_history
export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history"
export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"
# Custom bindings
bindkey '^ ' autosuggest-accept
# Add executable directories into PATH
PATH+=":$HOME/.local/bin"
# Force pipenv to create new enviroments within projects
export PIPENV_VENV_IN_PROJECT=1
# Load zsh-syntax-highlighting (should be last)
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Load extensions (should be last)
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null # Syntax highlighting
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null # Auto suggestions
source /etc/profile.d/autojump.sh 2>/dev/null # Auto-Jump
#neofetch --cpu_temp C --gtk2 off --gtk3 off --color_blocks on --pixterm