dotfiles/.config/zsh/functions

22 lines
708 B
Plaintext
Raw Normal View History

2022-07-29 20:51:50 -05:00
#!/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)
2022-07-29 23:41:27 -05:00
if ! [ -d "$ZSH_CONFIG/plugins/$PLUGIN_NAME" ]; then
2022-07-29 20:51:50 -05:00
git clone "https://github.com/$1.git" "$ZSH_CONFIG/plugins/$PLUGIN_NAME"
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"
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)
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)
}