dotfiles

:)
git clone https://git.sr.ht/~ashymad/dotfiles
Log | Files | Refs | Submodules | LICENSE

commit dc55231a55b6ff6bd77631e8a7f9b9de6c1b14c7
parent f61c418a8b9bfaa7a423423c534dd88c93c61717
Author: Szymon Mikulicz <szymon.mikulicz@posteo.net>
Date:   Wed, 25 Mar 2026 21:33:30 +0100

Add zsh

Diffstat:
Azsh/.zimrc | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Azsh/.zimrc.d/module-custom.zsh | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Azsh/.zshenv | 4++++
Azsh/.zshrc | 131+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 264 insertions(+), 0 deletions(-)

diff --git a/zsh/.zimrc b/zsh/.zimrc @@ -0,0 +1,58 @@ +# Start configuration added by Zim Framework install {{{ +# +# This is not sourced during shell startup and is only used to configure zimfw. +# + +# +# Modules +# + +# Sets sane Zsh built-in environment options. +zmodule environment +# Provides handy git aliases and functions. +zmodule git +# Applies correct bindkeys for input events. +zmodule input +# Sets a custom terminal title. +zmodule termtitle +# Utility aliases and functions. Adds colour to ls, grep and less. +zmodule utility + +# +# Prompt +# + +# Exposes how long the last command took to run to prompts. +zmodule duration-info +# Exposes git repository status information to prompts. +zmodule git-info +zmodule prompt-pwd +# A heavily reduced, ASCII-only version of the Spaceship and Starship prompts. +zmodule sorin + +# +# Completion +# + +# Additional completion definitions for Zsh. +zmodule zsh-users/zsh-completions --fpath src +# Enables and configures smart and extensive tab completion, must be sourced +# after all modules that add completion definitions. +zmodule completion + +# +# Modules that must be initialized last +# + +# Fish-like syntax highlighting for Zsh, must be sourced after completion. +zmodule zsh-users/zsh-syntax-highlighting +# Fish-like history search for Zsh, must be sourced after zsh-users/zsh-syntax-highlighting. +zmodule zsh-users/zsh-history-substring-search +# Fish-like autosuggestions for Zsh. +zmodule zsh-users/zsh-autosuggestions +# }}} End configuration added by Zim Framework install + +source ~/.zimrc.d/module-custom.zsh + +zmodule-custom mise --if-command "mise" --comp "mise completion zsh" --eval "mise activate zsh" +zmodule-custom zoxide --if-command "zoxide" --eval "zoxide init zsh" diff --git a/zsh/.zimrc.d/module-custom.zsh b/zsh/.zimrc.d/module-custom.zsh @@ -0,0 +1,71 @@ +zmodule-custom() { + local zcommand zname ztarget + local -a zargs + zcommand=${1} + zname=custom/${zcommand} + shift + while (( # > 0 )); do + case ${1} in + --name) + shift + zname=${1} + ;; + --if) + shift + zargs+=(--if "(( \${+commands[${zcommand}]} )) && ${1}") + ;; + --if-command) + shift + zargs+=(--if "(( \${+commands[${zcommand}]} && \${+commands[${1}]} ))") + ;; + --if-ostype) + shift + zargs+=(--if "(( \${+commands[${zcommand}]} )) && [[ \${OSTYPE} == ${1} ]]") + ;; + --on-pull) + shift + zargs+=(--on-pull ${1}) + ;; + -d|--disabled) + zargs+=(--disabled) + ;; + -f|--fpath) + shift + zargs+=(--fpath ${1}) + ;; + -a|--autoload) + shift + zargs+=(--autoload ${1}) + ;; + -s|--source) + shift + zargs+=(--source ${1}) + ;; + -c|--cmd) + shift + zargs+=(--cmd ${1}) + ;; + --comp) + shift + ztarget=functions/_${1//[^[:IDENT:]]/-} + zargs+=(--on-pull "mkdir -p functions") + zargs+=(--fpath functions) + zargs+=(--cmd "if [[ ! {}/${ztarget} -nt \${commands[${zcommand}]} ]]; then ${1} >! {}/${ztarget}; fi") + zargs+=(--cmd "if (( \${+_comps} && ! \${+_comps[${zcommand}]} )); then autoload -Uz ${ztarget:t}; _comps[${zcommand}]=${ztarget:t}; fi") + ;; + --eval) + shift + ztarget=${1//[^[:IDENT:]]/-}.zsh + zargs+=(--cmd "if [[ ! {}/${ztarget} -nt \${commands[${zcommand}]} ]]; then ${1} >! {}/${ztarget}; zcompile -UR {}/${ztarget}; fi") + zargs+=(--source ${ztarget}) + ;; + *) + print "Unknown zmodule option ${1}" + return 2 + ;; + esac + shift + done + + zmodule custom-${zcommand} --name ${zname} --use mkdir --if-command ${zcommand} ${zargs} +} diff --git a/zsh/.zshenv b/zsh/.zshenv @@ -0,0 +1,4 @@ +skip_global_compinit=1 +export PATH="$PATH:$HOME/.local/bin:$HOME/.usr/local/bin" +export EDITOR=nvim +export SUDO_EDITOR=nvim diff --git a/zsh/.zshrc b/zsh/.zshrc @@ -0,0 +1,131 @@ +# Start configuration added by Zim Framework install {{{ +# +# User configuration sourced by interactive shells +# + +# ----------------- +# Zsh configuration +# ----------------- + +# +# History +# + +# Remove older command from the history if a duplicate is to be added. +setopt HIST_IGNORE_ALL_DUPS + +# +# Input/output +# + +# Set editor default keymap to emacs (`-e`) or vi (`-v`) +bindkey -e + +# 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//[\/]} + +# ------------------- +# zimfw configuration +# ------------------- + +# Use degit instead of git as the default tool to install and update modules. +#zstyle ':zim:zmodule' use 'degit' + +# -------------------- +# Module configuration +# -------------------- + +# +# git +# + +# Set a custom prefix for the generated aliases. The default prefix is 'G'. +#zstyle ':zim:git' aliases-prefix 'g' + +# +# input +# + +# Append `../` to your input for each `.` you type after an initial `..` +#zstyle ':zim:input' double-dot-expand yes + +# +# termtitle +# + +# 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' format '%1~' + +# +# zsh-autosuggestions +# + +# Disable automatic widget re-binding on each precmd. This can be set when +# zsh-users/zsh-autosuggestions is the last module in your ~/.zimrc. +ZSH_AUTOSUGGEST_MANUAL_REBIND=1 + +# Customize the style that the suggestions are shown with. +# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style +#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242' + +# +# zsh-syntax-highlighting +# + +# 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' + +# ------------------ +# Initialize modules +# ------------------ + +ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim +# Download zimfw plugin manager if missing. +if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then + if (( ${+commands[curl]} )); then + curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \ + https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh + else + mkdir -p ${ZIM_HOME} && wget -nv -O ${ZIM_HOME}/zimfw.zsh \ + https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh + fi +fi +# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated. +if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then + source ${ZIM_HOME}/zimfw.zsh init +fi +# Initialize modules. +source ${ZIM_HOME}/init.zsh + +# ------------------------------ +# Post-init module configuration +# ------------------------------ + +# +# zsh-history-substring-search +# + +zmodload -F zsh/terminfo +p:terminfo +# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init +for key ('^[[A' '^P' ${terminfo[kcuu1]}) bindkey ${key} history-substring-search-up +for key ('^[[B' '^N' ${terminfo[kcud1]}) bindkey ${key} history-substring-search-down +for key ('k') bindkey -M vicmd ${key} history-substring-search-up +for key ('j') bindkey -M vicmd ${key} history-substring-search-down +unset key +# }}} End configuration added by Zim Framework install + +# Created by newuser for 5.9