private_dot_zshrc.tmpl

  1# Remove older command from the history if a duplicate is to be added.
  2setopt HIST_IGNORE_ALL_DUPS
  3# Prompt for spelling correction of commands.
  4setopt CORRECT
  5# Customize spelling correction prompt.
  6SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
  7# Remove path separator from WORDCHARS.
  8WORDCHARS=${WORDCHARS//[\/]}
  9# Use degit instead of git as the default tool to install and update modules.
 10zstyle ':zim:zmodule' use 'degit'
 11# Set a custom prefix for the generated aliases. The default prefix is 'G'.
 12#zstyle ':zim:git' aliases-prefix 'g'
 13# Append `../` to your input for each `.` you type after an initial `..`
 14zstyle ':zim:input' double-dot-expand yes
 15# Set a custom terminal title format using prompt expansion escape sequences.
 16# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
 17# If none is provided, the default '%n@%m: %~' is used.
 18zstyle ':zim:termtitle' hooks 'preexec' 'precmd'
 19zstyle ':zim:termtitle:preexec' format '${${(A)=1}[1]}'
 20zstyle ':zim:termtitle:precmd'  format '%1~'
 21# Customize the style that the suggestions are shown with.
 22# Set what highlighters will be used.
 23# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
 24ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
 25# Customize the main highlighter styles.
 26# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
 27#typeset -A ZSH_HIGHLIGHT_STYLES
 28#ZSH_HIGHLIGHT_STYLES[comment]='fg=242'
 29
 30export ZIM_HOME="$HOME/.zim"
 31
 32# ------------------
 33# Initialize modules
 34# ------------------
 35if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
 36  # Download zimfw script if missing.
 37  command mkdir -p ${ZIM_HOME}
 38  if (( ${+commands[curl]} )); then
 39    command curl -fsSL -o ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
 40  else
 41    command wget -nv -O ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
 42  fi
 43fi
 44if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
 45  # Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
 46  source ${ZIM_HOME}/zimfw.zsh init -q
 47fi
 48source ${ZIM_HOME}/init.zsh
 49
 50# ------------------------------
 51# Post-init module configuration
 52# ------------------------------
 53
 54# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
 55bindkey '^[[A' history-substring-search-up
 56bindkey '^[[B' history-substring-search-down
 57
 58# Bind up and down keys
 59zmodload -F zsh/terminfo +p:terminfo
 60if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
 61  bindkey ${terminfo[kcuu1]} history-substring-search-up
 62  bindkey ${terminfo[kcud1]} history-substring-search-down
 63fi
 64
 65bindkey '^P' history-substring-search-up
 66bindkey '^N' history-substring-search-down
 67bindkey -M vicmd 'k' history-substring-search-up
 68bindkey -M vicmd 'j' history-substring-search-down
 69# End configuration added by Zim install
 70
 71# Executable paths
 72export PATH="$PATH:$HOME/dotfiles/bin"
 73export PATH="$PATH:$HOME/.emacs.d/bin"
 74export PATH="$PATH:$HOME/.cargo/bin"
 75export PATH="$PATH:$HOME/.local/bin"
 76export ANDROID_HOME="$HOME/SDKs/Android"
 77export PATH="$PATH:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator"
 78export PATH="$PATH:$HOME/.gem/ruby/2.7.0/bin"
 79export PATH="$PATH:$HOME/.gem/ruby/3.0.0/bin"
 80export PATH="$PATH:$HOME/.go/bin"
 81export PATH="{{ .chezmoi.homeDir }}/perl5/bin${PATH:+:${PATH}}"; export PATH;
 82export PERL5LIB="{{ .chezmoi.homeDir }}/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
 83export PERL_LOCAL_LIB_ROOT="{{ .chezmoi.homeDir }}/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
 84export PERL_MB_OPT="--install_base \"{{ .chezmoi.homeDir }}/perl5\""; export PERL_MB_OPT;
 85export PERL_MM_OPT="INSTALL_BASE={{ .chezmoi.homeDir }}/perl5"; export PERL_MM_OPT;
 86
 87# Additional preferences
 88export LANG=en_GB.UTF-8
 89export EDITOR='devour emacsclient -c'
 90export VISUAL='devour emacsclient -c'
 91export _JAVA_AWT_WM_NONREPARENTING=1
 92export MANPAGER="nvim +Man!"
 93export COLUMNS=80
 94export MANWIDTH=80
 95export GOPATH="$HOME/.go"
 96
 97CASE_SENSITIVE="false"
 98
 99# Disable dumb Python keyring integration
100export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
101
102#HYPHEN_INSENSITIVE="true"
103# Uncomment the following line if pasting URLs and other text is messed up.
104# DISABLE_MAGIC_FUNCTIONS=true
105
106# Additional completions
107compctl -g '~/.teamocil/*(:t:r)' teamocil
108
109# Integrate z - jump around
110source /usr/share/z/z.sh
111
112# Integrate FZF
113source /usr/share/fzf/key-bindings.zsh
114source /usr/share/fzf/completion.zsh
115
116# Ranger conf
117export RANGER_LOAD_DEFAULT_RC=false
118
119# Bunch of aliases
120alias e="$EDITOR"
121alias u="linx-client"
122alias vim="nvim"
123alias clip="xclip -selection clipboard"
124alias tmp="cd $(mktemp -d)"
125alias send="rsync -avmzzP"
126alias tree="exa --tree"
127alias bat="bat -n --theme base16 --tabs 2"
128alias mov="ranger ~/Bulk/Media/Movies"
129alias tv="ranger ~/Bulk/Media/TV\ Shows"
130alias yt="ranger ~/Bulk/Media/YouTube"
131alias pass='str="$(pwgen -s 25 1)" && echo "$str" && echo -n "$str" | xclip -selection clipboard'
132alias secluded="cd ~/repos/sites/secluded/ && hugo --cleanDestinationDir && rsync -avmzz public/ hel1:/var/www/secluded/"
133alias erase="shred -vzfun 32"
134alias 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'"
135alias us="unsilence -t 15 -as 1.25"
136alias roll="roll -v"
137alias sxiv="sxiv -p"
138alias tt="tasktimer"
139alias c="chezmoi"
140alias t="todo"
141alias h="hledger"
142
143# Additional functions
144function gi() {
145    curl -sLw https://www.toptal.com/developers/gitignore/api/$@ ;
146}
147function noti() {
148    curl 'https://notify.nixnet.services/message?token={{- .gotify_token -}}' -F "title=$1" -F "message=$2" -F "priority=4"
149}
150# Hide the terminal when these apps are opened from a terminal
151function zathura() { devour zathura "$1" }
152function inkscape() { devour inkscape "$1" }
153
154autoload -U +X bashcompinit && bashcompinit
155
156# Necessary for SSH & YubiKey
157export GPG_TTY="$TTY"
158export SSH_AUTH_SOCK="/run/user/1000/gnupg/S.gpg-agent.ssh"
159gpgconf --launch gpg-agent
160
161eval "$(starship init zsh)"