# Remove older command from the history if a duplicate is to be added. setopt HIST_IGNORE_ALL_DUPS # Prompt for spelling correction of commands. setopt CORRECT # Customize spelling correction prompt. SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' # Remove path separator from WORDCHARS. WORDCHARS=${WORDCHARS//[\/]} # Use degit instead of git as the default tool to install and update modules. zstyle ':zim:zmodule' use 'degit' # Set a custom prefix for the generated aliases. The default prefix is 'G'. #zstyle ':zim:git' aliases-prefix 'g' # Append `../` to your input for each `.` you type after an initial `..` zstyle ':zim:input' double-dot-expand yes # Set a custom terminal title format using prompt expansion escape sequences. # See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes # If none is provided, the default '%n@%m: %~' is used. zstyle ':zim:termtitle' hooks 'preexec' 'precmd' zstyle ':zim:termtitle:preexec' format '${${(A)=1}[1]}' zstyle ':zim:termtitle:precmd' format '%1~' # Customize the style that the suggestions are shown with. # Set what highlighters will be used. # See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) # Customize the main highlighter styles. # See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it #typeset -A ZSH_HIGHLIGHT_STYLES #ZSH_HIGHLIGHT_STYLES[comment]='fg=242' # XDG variables export XDG_DATA_HOME="$HOME/.local/share" export XDG_CONFIG_HOME="$HOME/.config" export XDG_STATE_HOME="$HOME/.local/state" export XDG_CACHE_HOME="$HOME/.cache" # Moving dotfiles around zstyle ':completion:*' cache-path "$XDG_CACHE_HOME"/zsh/zcompcache export HISTFILE="$XDG_STATE_HOME"/zsh/history export ZDOTDIR="$HOME"/.config/zsh export WINEPREFIX="$XDG_DATA_HOME"/wine export WORKON_HOME="$XDG_DATA_HOME/virtualenvs" export SQLITE_HISTORY="$XDG_CACHE_HOME"/sqlite_history export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages export DVDCSS_CACHE="$XDG_DATA_HOME"/dvdcss export KDEHOME="$XDG_CONFIG_HOME"/kde export GOPATH="$XDG_DATA_HOME"/go export GNUPGHOME="$XDG_DATA_HOME"/gnupg export ZIM_HOME="$XDG_CONFIG_HOME"/.zim alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts" alias svn="svn --config-dir $XDG_CONFIG_HOME/subversion" eval "$(antidot init)" # ------------------ # Initialize modules # ------------------ if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then # Download zimfw script if missing. command mkdir -p ${ZIM_HOME} if (( ${+commands[curl]} )); then command curl -fsSL -o ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh else command wget -nv -O ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh fi fi if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then # Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated. source ${ZIM_HOME}/zimfw.zsh init -q fi source ${ZIM_HOME}/init.zsh # ------------------------------ # Post-init module configuration # ------------------------------ # Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down # Bind up and down keys zmodload -F zsh/terminfo +p:terminfo if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then bindkey ${terminfo[kcuu1]} history-substring-search-up bindkey ${terminfo[kcud1]} history-substring-search-down fi bindkey '^P' history-substring-search-up bindkey '^N' history-substring-search-down bindkey -M vicmd 'k' history-substring-search-up bindkey -M vicmd 'j' history-substring-search-down # End configuration added by Zim install # Executable paths export PATH="$PATH:$HOME/dotfiles/bin" export PATH="$PATH:$HOME/.emacs.d/bin" export PATH="$PATH:$HOME/.cargo/bin" export PATH="$PATH:$HOME/.local/bin" export ANDROID_HOME="$HOME/SDKs/Android" export PATH="$PATH:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator" export PATH="$PATH:$HOME/.gem/ruby/2.7.0/bin" export PATH="$PATH:$HOME/.gem/ruby/3.0.0/bin" export PATH="$PATH:$GOPATH/bin" # Additional preferences export LANG=en_GB.UTF-8 export EDITOR='devour emacsclient -c' export VISUAL='devour emacsclient -c' export _JAVA_AWT_WM_NONREPARENTING=1 export MANPAGER="nvim +Man!" export COLUMNS=80 export MANWIDTH=80 export CHARM_HOST=charm.secluded.site CASE_SENSITIVE="false" # Disable dumb Python keyring integration export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring #HYPHEN_INSENSITIVE="true" # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS=true # Additional completions source <(charm completion zsh) # Integrate z - jump around source /usr/share/z/z.sh # Integrate FZF source /usr/share/fzf/key-bindings.zsh source /usr/share/fzf/completion.zsh # Conda crap [ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh # Ranger conf export RANGER_LOAD_DEFAULT_RC=false # Bunch of aliases alias ts="tailscale" alias tmateqr='tmate show-messages | tail -n 1 | qrencode -o - -t ANSIUTF8' alias info="info --vi-keys" alias datetime="date +%Y-%m-%d_%H%M%S_%Z" alias e="$EDITOR" alias u="linx-client" alias clip="xclip -selection clipboard" alias tmp="cd $(mktemp -d)" alias send="rsync -avmzzP" alias tree="exa --tree" alias bat="bat -n --theme base16 --tabs 2" alias mov="ranger ~/Bulk/Media/Movies" alias tv="ranger ~/Bulk/Media/TV\ Shows" alias yt="ranger ~/Bulk/Media/YouTube" alias pass='str="$(pwgen -s 25 1)" && echo "$str" && echo -n "$str" | xclip -selection clipboard' alias secluded="cd ~/repos/personal/secluded && hugo --cleanDestinationDir && rsync -avmzz public/ hel1:/var/www/secluded/" alias erase="shred -vzfun 32" alias dl="yt-dlp -f bestvideo+bestaudio --write-sub --write-auto-sub --sub-lang en --sub-format srt/best --convert-subs srt --embed-subs -o '%(upload_date)s %(title)s.%(ext)s'" alias us="unsilence -t 15 -as 1.25" alias roll="roll -v" alias sxiv="sxiv -p" alias tt="tasktimer" alias c="chezmoi" alias t="todo" alias h="hledger" # Additional functions function gi() { curl -sLw https://www.toptal.com/developers/gitignore/api/$@ ; } function noti() { curl 'https://notify.nixnet.services/message?token={{- secret "lookup" "Title" "gotify-token" -}}' -F "title=$1" -F "message=$2" -F "priority=4" } # Hide the terminal when these apps are opened from a terminal function zathura() { devour zathura "$1" } function inkscape() { devour inkscape "$1" } autoload -U +X bashcompinit && bashcompinit # Necessary for SSH & YubiKey export GPG_TTY="$TTY" export SSH_AUTH_SOCK="/run/user/1000/gnupg/S.gpg-agent.ssh" gpgconf --launch gpg-agent eval "$(starship init zsh)" zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate zstyle ':completion:*' group-name '' zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s zstyle ':completion:*' menu select=1 zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle :compinstall filename '/home/amolith/.config/zsh/.zshrc' autoload -Uz compinit compinit compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"