dotfiles/.config/zsh/functions

24 lines
785 B
Plaintext
Raw Permalink Normal View History

2022-07-29 20:51:50 -05:00
#!/bin/zsh
function zsh_add_config() {
2024-05-15 23:48:45 -05:00
[ -f "$ZDOTDIR/$1" ] && ! [ -L "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1"
2022-07-29 20:51:50 -05:00
}
function zsh_add_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
2024-05-15 23:48:45 -05:00
if ! [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
2022-07-29 20:51:50 -05:00
fi
2022-07-29 23:41:27 -05:00
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
2024-05-15 23:48:45 -05:00
zsh_add_config "plugins/$PLUGIN_NAME/async"
zsh_add_config "plugins/$PLUGIN_NAME/nix.plugin.zsh"
2022-07-29 20:51:50 -05:00
}
2022-08-20 00:31:06 -05:00
function zsh_fpath_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
2024-05-15 23:48:45 -05:00
if ! [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
2022-08-20 00:31:06 -05:00
fi
2024-05-15 23:48:45 -05:00
fpath+=($ZDOTDIR/plugins/$PLUGIN_NAME)
2022-08-20 00:31:06 -05:00
}