private_dot_zshrc.tmpl

  1# Start configuration added by Zim install
  2#
  3# User configuration sourced by interactive shells
  4#
  5
  6# -----------------
  7# Zsh configuration
  8# -----------------
  9
 10#
 11# History
 12#
 13
 14# Remove older command from the history if a duplicate is to be added.
 15setopt HIST_IGNORE_ALL_DUPS
 16
 17#
 18# Input/output
 19#
 20
 21# Set editor default keymap to emacs (`-e`) or vi (`-v`)
 22bindkey -e
 23
 24# Prompt for spelling correction of commands.
 25setopt CORRECT
 26
 27# Customize spelling correction prompt.
 28#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
 29
 30# Remove path separator from WORDCHARS.
 31WORDCHARS=${WORDCHARS//[\/]}
 32
 33# -----------------
 34# Zim configuration
 35# -----------------
 36
 37# Use degit instead of git as the default tool to install and update modules.
 38#zstyle ':zim:zmodule' use 'degit'
 39
 40# --------------------
 41# Module configuration
 42# --------------------
 43
 44#
 45# completion
 46#
 47
 48# Set a custom path for the completion dump file.
 49# If none is provided, the default ${ZDOTDIR:-${HOME}}/.zcompdump is used.
 50#zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}"
 51
 52#
 53# git
 54#
 55
 56# Set a custom prefix for the generated aliases. The default prefix is 'G'.
 57#zstyle ':zim:git' aliases-prefix 'g'
 58
 59#
 60# input
 61#
 62
 63# Append `../` to your input for each `.` you type after an initial `..`
 64zstyle ':zim:input' double-dot-expand yes
 65
 66#
 67# termtitle
 68#
 69
 70# Set a custom terminal title format using prompt expansion escape sequences.
 71# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
 72# If none is provided, the default '%n@%m: %~' is used.
 73zstyle ':zim:termtitle' format '%1~'
 74
 75#
 76# zsh-autosuggestions
 77#
 78
 79# Customize the style that the suggestions are shown with.
 80# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style
 81#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242'
 82
 83#
 84# zsh-syntax-highlighting
 85#
 86
 87# Set what highlighters will be used.
 88# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
 89ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
 90
 91# Customize the main highlighter styles.
 92# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
 93#typeset -A ZSH_HIGHLIGHT_STYLES
 94#ZSH_HIGHLIGHT_STYLES[comment]='fg=242'
 95
 96# ------------------
 97# Initialize modules
 98# ------------------
 99
100if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
101  # Download zimfw script if missing.
102  command mkdir -p ${ZIM_HOME}
103  if (( ${+commands[curl]} )); then
104    command curl -fsSL -o ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
105  else
106    command wget -nv -O ${ZIM_HOME}/zimfw.zsh https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
107  fi
108fi
109if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
110  # Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
111  source ${ZIM_HOME}/zimfw.zsh init -q
112fi
113source ${ZIM_HOME}/init.zsh
114
115# ------------------------------
116# Post-init module configuration
117# ------------------------------
118
119#
120# zsh-history-substring-search
121#
122
123# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
124bindkey '^[[A' history-substring-search-up
125bindkey '^[[B' history-substring-search-down
126
127# Bind up and down keys
128zmodload -F zsh/terminfo +p:terminfo
129if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
130  bindkey ${terminfo[kcuu1]} history-substring-search-up
131  bindkey ${terminfo[kcud1]} history-substring-search-down
132fi
133
134bindkey '^P' history-substring-search-up
135bindkey '^N' history-substring-search-down
136bindkey -M vicmd 'k' history-substring-search-up
137bindkey -M vicmd 'j' history-substring-search-down
138# End configuration added by Zim install
139
140# Executable paths
141export PATH="$PATH:$HOME/dotfiles/bin"
142export PATH="$PATH:$HOME/.emacs.d/bin"
143export PATH="$PATH:$HOME/.cargo/bin"
144export PATH="$PATH:$HOME/.local/bin"
145export ANDROID_HOME="$HOME/SDKs/Android"
146export PATH="$PATH:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator"
147export PATH="$PATH:$HOME/.gem/ruby/2.7.0/bin"
148export PATH="$PATH:$HOME/.gem/ruby/3.0.0/bin"
149export PATH="$PATH:$HOME/go/bin"
150
151CASE_SENSITIVE="false"
152
153export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
154
155#HYPHEN_INSENSITIVE="true"
156# Uncomment the following line if pasting URLs and other text is messed up.
157# DISABLE_MAGIC_FUNCTIONS=true
158
159# Uncomment the following line if you want to disable marking untracked files
160# under VCS as dirty. This makes repository status check for large repositories
161# much, much faster.
162# DISABLE_UNTRACKED_FILES_DIRTY="true"
163
164#plugins=(
165#    git
166#    golang
167#    zsh-autosuggestions
168#    zsh-completions
169#    lxd-completion-zsh
170#    fzf-zsh
171#)
172
173# Other completions
174compctl -g '~/.teamocil/*(:t:r)' teamocil
175
176#source $ZSH/oh-my-zsh.sh
177source /usr/share/z/z.sh
178
179# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
180#[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
181
182#source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
183
184# Ranger conf
185export RANGER_LOAD_DEFAULT_RC=false
186
187export LANG=en_GB.UTF-8
188export EDITOR='devour emacsclient -c'
189export VISUAL='devour emacsclient -c'
190export _JAVA_AWT_WM_NONREPARENTING=1
191export MANPAGER="nvim +Man!"
192export COLUMNS=80
193export MANWIDTH=80
194
195alias e="$EDITOR"
196alias u="linx-client"
197alias vim="nvim"
198alias tmp="cd $(mktemp -d)"
199alias send="rsync -avmzzP"
200alias tree="exa --tree"
201alias bat="bat -n --theme base16 --tabs 2"
202alias mov="ranger ~/Videos/Movies"
203alias tv="ranger ~/Videos/TV\ Shows"
204alias yt="ranger ~/Videos/YouTube"
205alias pass='str="$(pwgen -s 25 1)" && echo "$str" && echo -n "$str" | xclip -selection clipboard'
206alias secluded="cd ~/repos/sites/secluded/ && hugo --cleanDestinationDir && rsync -avmzz public/ hel1-srv1:/var/www/secluded/"
207alias erase="shred -vzfun 32"
208alias dl="youtube-dl -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'"
209alias us="unsilence -t 15 -as 1.25"
210alias dotgit="python3 ~/dotfiles/dotgit/dotgit/__main__.py"
211alias roll="roll -v"
212alias dn="notify-send done"
213alias sxiv="sxiv -p"
214alias tt="tasktimer"
215
216# devour windows
217function zathura() { devour zathura "$1" }
218function inkscape() { devour inkscape "$1" }
219
220# Functions
221function gi() {
222    curl -sLw n https://www.toptal.com/developers/gitignore/api/$@ ;
223}
224function noti() {
225    curl 'https://notify.nixnet.services/message?token={{- .gotify_token -}}' -F "title=$1" -F "message=$2" -F "priority=4"
226}
227
228PATH="{{ .chezmoi.homeDir }}/perl5/bin${PATH:+:${PATH}}"; export PATH;
229PERL5LIB="{{ .chezmoi.homeDir }}/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
230PERL_LOCAL_LIB_ROOT="{{ .chezmoi.homeDir }}/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
231PERL_MB_OPT="--install_base \"{{ .chezmoi.homeDir }}/perl5\""; export PERL_MB_OPT;
232PERL_MM_OPT="INSTALL_BASE={{ .chezmoi.homeDir }}/perl5"; export PERL_MM_OPT;
233autoload -U +X bashcompinit && bashcompinit
234complete -o nospace -C /usr/local/bin/bitcomplete bit
235
236
237# Necessary for SSH & YubiKey
238export GPG_TTY="$TTY"
239export SSH_AUTH_SOCK="/run/user/1000/gnupg/S.gpg-agent.ssh"
240gpgconf --launch gpg-agent