Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a way to work with config.fish #795

Open
rafaScalet opened this issue Feb 15, 2025 · 1 comment
Open

add a way to work with config.fish #795

rafaScalet opened this issue Feb 15, 2025 · 1 comment

Comments

@rafaScalet
Copy link

rafaScalet commented Feb 15, 2025

I think it would be really cool to have an approach where plugins are declared in config.fish, like in fundle. I really like Fisher because it feels more organized than fundle, but I also find fundle's functionality of declaring plugins in config.fish very useful - so much so that I even implemented my own solution to make this work.

if status --is-interactive
  if not functions -q fisher
    curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher > /dev/null
    fisher update > /dev/null
  end
end

function @plugin; set -g plugins $plugins (string lower $argv[1]); end

@plugin jorgebucaran/fisher
@plugin jorgebucaran/autopair.fish
@plugin jorgebucaran/replay.fish
@plugin rafascalet/docker-db.fish
@plugin rafascalet/let-prompt.fish
@plugin jhillyerd/plugin-git
@plugin nickeb96/puffer-fish
@plugin gazorby/fish-abbreviation-tips

function plugins --argument-names command
  set -g installed_plugins (fisher ls)

  switch $command
    case "install" "i" "add"
      install_plugins
    case "uninstall" "rm" "remove"
      remove_plugins
    case "update" "up" "upgrade" "init"
      update_plugins
  end
end

function install_plugins
  # Instalar plugins ausentes
  for plugin in $plugins
    if not contains $plugin $installed_plugins
      fisher install $plugin | head -n 3 | tail -n 1 | string replace "Installing" (set_color normal)"Installing"(set_color green)
    end
  end
end

function remove_plugins
  # Remover plugins que não estão mais na lista
  for installed_plugin in $installed_plugins
    if not contains $installed_plugin $plugins
      fisher remove $installed_plugin | grep 'Removing' --color=never
    end
  end
end

function update_plugins
  install_plugins
  remove_plugins
end

Do you think it would be nice to have this functionality natively in Fisher?

@jorgebucaran
Copy link
Owner

Adding this functionality to Fisher could introduce unexpected complications, but I'm not entirely against the idea. That said, I personally lean against it. Fisher was and is still intended to be used primarily interactively, which is in the spirit of Fish (the friendly interactive shell).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants