Wrote a "plugin manager" shell function. Any ideas for improvement?

This page summarizes the projects mentioned and recommended in the original post on /r/zsh

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • zsh-autosuggestions

    Fish-like autosuggestions for zsh

    if (($+commands[git])); then use_plugin() { local root_dir="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins" local plugin_name=${1:t} # grabbing the 5th field works for a Github url, not necessarily for every url. local plugin_dir=$root_dir/${1//[/:]/_} if ! [[ -d $plugin_dir ]] echo $EPOCHSECONDS > $plugin_dir/update_timestamp # don't continue if cloning failed git clone --depth 1 "$1" "$plugin_dir" || return local timestamp read -r timestamp < $plugin_dir/update_timestamp if ((EPOCHSECONDS - timestamp > 864000)); then # don't update timestamp if pull failed git -C $plugin_dir pull && echo $EPOCHSECONDS > $plugin_dr/update_timestamp # Match common source filenames local file for file in ($plugin_name|${plugin_name:l}).(plugin.zsh|zsh|zsh-theme)(N); do source $plugin_dir/$filename && break done } use_plugin 'https://github.com/zsh-users/zsh-autosuggestions' use_plugin 'https://github.com/zsh-users/zsh-syntax-highlighting' fi

  • zsh-syntax-highlighting

    Fish shell like syntax highlighting for Zsh.

    if (($+commands[git])); then use_plugin() { local root_dir="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins" local plugin_name=${1:t} # grabbing the 5th field works for a Github url, not necessarily for every url. local plugin_dir=$root_dir/${1//[/:]/_} if ! [[ -d $plugin_dir ]] echo $EPOCHSECONDS > $plugin_dir/update_timestamp # don't continue if cloning failed git clone --depth 1 "$1" "$plugin_dir" || return local timestamp read -r timestamp < $plugin_dir/update_timestamp if ((EPOCHSECONDS - timestamp > 864000)); then # don't update timestamp if pull failed git -C $plugin_dir pull && echo $EPOCHSECONDS > $plugin_dr/update_timestamp # Match common source filenames local file for file in ($plugin_name|${plugin_name:l}).(plugin.zsh|zsh|zsh-theme)(N); do source $plugin_dir/$filename && break done } use_plugin 'https://github.com/zsh-users/zsh-autosuggestions' use_plugin 'https://github.com/zsh-users/zsh-syntax-highlighting' fi

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • dootsfile

    Discontinued 🏠 - Personal Dotfiles (Managed by GNU Stow)

    [Source]([https://github.com/lime-desu/dootsfile/blob/main/config/zsh/functions/oh-my-zsh.zsh)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts