Skip to content

Instantly share code, notes, and snippets.

@Fitzy1293
Created June 30, 2023 15:49
Show Gist options
  • Save Fitzy1293/1b1ba640ef94af656c51e20ed6bfeda9 to your computer and use it in GitHub Desktop.
Save Fitzy1293/1b1ba640ef94af656c51e20ed6bfeda9 to your computer and use it in GitHub Desktop.
Working zshrc, works!
#---------------------------------------------------------------------------------------------------------------------
# _____ _____ _____
# /\ \ /\ \ /\ \
# /::\ \ /::\ \ /::\____\
# \:::\ \ /::::\ \ /:::/ /
# \:::\ \ /::::::\ \ /:::/ /
# \:::\ \ /:::/\:::\ \ /:::/ /
# \:::\ \ /:::/__\:::\ \ /:::/____/
# \:::\ \ \:::\ \:::\ \ /::::\ \
# \:::\ \ ___\:::\ \:::\ \ /::::::\ \ _____
# \:::\ \ /\ \:::\ \:::\ \ /:::/\:::\ \ /\ \
# _______________\:::\____\/::\ \:::\ \:::\____\/:::/ \:::\ /::\____\
# \::::::::::::::::::/ /\:::\ \:::\ \::/ /\::/ \:::\ /:::/ /
# \::::::::::::::::/____/ \:::\ \:::\ \/____/ \/____/ \:::\/:::/ /
# \:::\~~~~\~~~~~~ \:::\ \:::\ \ \::::::/ /
# \:::\ \ \:::\ \:::\____\ \::::/ /
# \:::\ \ \:::\ /:::/ / /:::/ /
# \:::\ \ \:::\/:::/ / /:::/ /
# \:::\ \ \::::::/ / /:::/ /
# \:::\____\ \::::/ / /:::/ /
# \::/ / \::/ / \::/ /
# \/____/ \/____/ \/____/
#
# _____ _____
# /\ \ /\ \
# /::\ \ /::\ \
# /::::\ \ /::::\ \
# /::::::\ \ /::::::\ \
# /:::/\:::\ \ /:::/\:::\ \
# /:::/__\:::\ \ /:::/ \:::\ \
# /::::\ \:::\ \ /:::/ \:::\ \
# /::::::\ \:::\ \ /:::/ / \:::\ \
# /:::/\:::\ \:::\____\ /:::/ / \:::\ \
# /:::/ \:::\ \:::| |/:::/____/ \:::\____\
# \::/ |::::\ /:::|____|\:::\ \ \::/ /
# \/____|:::::\/:::/ / \:::\ \ \/____/
# |:::::::::/ / \:::\ \
# |::|\::::/ / \:::\ \
# |::| \::/____/ \:::\ \
# |::| ~| \:::\ \
# |::| | \:::\ \
# \::| | \:::\____\
# \:| | \::/ /
# \|___| \/____/
#---------------------------------------------------------------------------------------------------------------------
# PS1—zsh style
PS1='%F{cyan}%D{%L:%M}%f %B%F{green}%n @ 🖥️%f %F{yellow}%~%f
%F{magenta}$ %f'
# paths that you don't have to be in the directory for to execute programs
export PATH=$PATH:~/bin
export PATH=$PATH:~/mybin
export PATH=$PATH:~/mybin/github
export PATH=$PATH:~/mybin
export PATH=$PATH:~/.yarn/bin
export PATH=$PATH:~/.local/bin
export PATH=$PATH:~/.i3/Live-Earth-Wallpapers
#---------------------------------------------------------------------------------------------------------------------
# keybindings to make it work a little like I'm used to
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5C" forward-word
bindkey "^[[3~" delete-char
#---------------------------------------------------------------------------------------------------------------------
# get colors for the terminal
export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:';
#---------------------------------------------------------------------------------------------------------------------
# make history work great
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt HIST_BEEP # Beep when accessing nonexistent history.
#---------------------------------------------------------------------------------------------------------------------
# vim bindings.
# NOT PERFECT, ~/.backup_zshrc has the dotfile without this incase this breaks or is too difficult
autoload -U compinit && compinit -u
zstyle ':completion:*' menu select
# Auto complete with case insenstivity
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# vi mode
bindkey -v
export KEYTIMEOUT=1
# Enable searching through history
bindkey '^R' history-incremental-pattern-search-backward
# Edit line in vim buffer ctrl-v
autoload edit-command-line; zle -N edit-command-line
bindkey '^v' edit-command-line
# Enter vim buffer from normal mode
autoload -U edit-command-line && zle -N edit-command-line && bindkey -M vicmd "^v" edit-command-line
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'left' vi-backward-char
bindkey -M menuselect 'down' vi-down-line-or-history
bindkey -M menuselect 'up' vi-up-line-or-history
bindkey -M menuselect 'right' vi-forward-char
# Fix backspace bug when switching modes
bindkey "^?" backward-delete-char
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
# ci", ci', ci`, di", etc
autoload -U select-quoted
zle -N select-quoted
for m in visual viopp; do
for c in {a,i}{\',\",\`}; do
bindkey -M $m $c select-quoted
done
done
#---------------------------------------------------------------------------------------------------------------------
# ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
# ▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
# ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
# ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
# ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄
# ▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
# ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀█░▌
# ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌
# ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▄▄▄▄█░█▄▄▄▄ ▐░▌ ▐░▌ ▄▄▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄█░▌
# ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
# ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀
alias ail='sed -e '\''s/ */ /g'\'' -e '\''s/ *//'\'' | cut -s -d '\'' '\'' -f 1 | xargs sudo apt install'
alias al='alias | pyalias.py'
alias aresamefiles='diff -s'
alias audioytdl='youtube-dl -f "bestaudio/best" -ciw -o "%(id)s.%(ext)s" -v --extract-audio'
alias bc='bc -l '
alias c='clear'
alias cl='clear'
alias clr='clear'
alias cop='xclip -selection c'
alias egrep='egrep --color=auto'
alias empty='rm ~/.local/share/Trash/files/* -rf'
alias fgrep='fgrep --color=auto'
alias g='grep --color=auto'
alias ga='git add'
alias gal='git add .'
alias gc='git commit -m'
alias gl='git log'
alias go='git push -u origin'
alias grep='grep --color=auto'
alias gs='git status'
alias gsh='git stash'
alias gst='git status -sb'
alias gw='git whatchanged'
alias h='history'
alias h1='history 10'
alias h2='history 20'
alias h3='history 30'
alias hgrep='history | grep'
alias ipython='ipython3'
alias l='ls -CF'
alias la='ls -A'
alias lf='ls -d $PWD/*'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias ls1='ls -1'
alias o='xdg-open'
alias pfin='processfinder.sh'
alias photoviewer='mpv --loop-playlist=inf --image-display-duration=inf'
alias pip='pip3'
alias pv='mpv --loop-playlist=inf --image-display-duration=inf'
alias py='/usr/bin/python '
alias python='/usr/bin/python'
alias sc='source ~/.zshrc'
alias t='tiktok.py'
alias trash='gio trash '
alias y='youtube-dl --restrict-filenames --write-all-thumbnails --embed-thumbnail --write-info-json --embed-subs --all-subs -o "%(id)s.%(ext)s"'
alias urldecode='python3 -c "import sys, urllib.parse as ul; print(ul.unquote_plus(sys.argv[1]))"'
alias urlencode='python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))"'
alias ad='cd /home/fit/Documents/podcasts/misc && clear'
alias prnt='~/mybin/prettyprinter.sh'
alias pr='for f in "$@"; do style_str="$(realpath ${f} && echo -e "syntax: $(pygmentize -g -N ${f})")" && f_text="$(pygmentize -g -O style=monokai ${f} | cat -n)" && printf "\n%s\n%s\n" "${style_str}" "${f_text}"; done && echo'
#---------------------------------------------------------------------------------------------------------------------
# _______ __ __
# | \ | \ | \
# | $$$$$$$\| $$ __ __ ______ \$$ _______ _______
# | $$__/ $$| $$| \ | \ / \ | \| \ / \
# | $$ $$| $$| $$ | $$| $$$$$$\| $$| $$$$$$$\| $$$$$$$
# | $$$$$$$ | $$| $$ | $$| $$ | $$| $$| $$ | $$ \$$ \
# | $$ | $$| $$__/ $$| $$__| $$| $$| $$ | $$ _\$$$$$$\
# | $$ | $$ \$$ $$ \$$ $$| $$| $$ | $$| $$
# \$$ \$$ \$$$$$$ _\$$$$$$$ \$$ \$$ \$$ \$$$$$$$
# | \__| $$
# \$$ $$
# \$$$$$$
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment