dotfiles/.config/zsh/functions
GRMrGecko 8fdb1e4d87 Replace ZDOTDIR with custom ZSH_CONFIG var and fix keybinds
Use ZSH_CONFIG instead of ZDOTDIR to avoid conflicts with zsh internals
(e.g. tmux). Register custom word-movement widgets with zle -N, remove
incorrect TERM="konsole" export, add local.zsh config loading, and add
~/.local/bin to PATH.
2026-02-13 09:05:36 -06:00

24 lines
809 B
Bash

#!/bin/zsh
function zsh_add_config() {
[ -f "$ZSH_CONFIG/$1" ] && ! [ -L "$ZSH_CONFIG/$1" ] && source "$ZSH_CONFIG/$1"
}
function zsh_add_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
if ! [ -d "$ZSH_CONFIG/plugins/$PLUGIN_NAME" ]; then
git clone "https://github.com/$1.git" "$ZSH_CONFIG/plugins/$PLUGIN_NAME"
fi
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
zsh_add_config "plugins/$PLUGIN_NAME/async"
zsh_add_config "plugins/$PLUGIN_NAME/nix.plugin.zsh"
}
function zsh_fpath_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
if ! [ -d "$ZSH_CONFIG/plugins/$PLUGIN_NAME" ]; then
git clone "https://github.com/$1.git" "$ZSH_CONFIG/plugins/$PLUGIN_NAME"
fi
fpath+=($ZSH_CONFIG/plugins/$PLUGIN_NAME)
}