Home

Awesome

shplug shplug Your new shell plugin manager - An easy solution for managing your shell environments.

There are two main use patterns:

Synced environments

Sync your files across multiple environments (aka machines) using a simple git repository.

Example

Let's say you have 2 different machines you use for development/administration/etc. You wanna sync your dotfiles: .gitconfig, .vimrc, .bashrc, .tmux.conf and possibly some scripts you always find useful to have on your machine.

Create a git repository, call it however you like and use the following structure:

Once you have shplug installed on your machine, you can get all those goodies using a single command:

shplug env add <env-name> <git-repo-url>

For example, I clone my dotfiles using:

shplug env add dotfiles https://github.com/dtrugman/dotfiles

When you run the command, the following will happen:

  1. The repository will be cloned locally into some hidden directory under your user's home (The user that executes the shplug env add command)
  2. All the files are going to be linked under your actual $HOME directory. Existing files are going to be backed-up and only then overriden. Don't worry, you will be notified of the changes and prompted for approval.
  3. The install script is going to be executed, just in case you want to automatically add the new scripts directory into your $PATH without any additional manual steps, install plug.vim and run :PlugInstall or do anything else automatically every time you sync the environment.

Notes:

  1. The install file is optional
  2. home is a hard-coded keyword for the $HOME of the user that will be using the environment. scripts is just an arbitrary name you can use. Any other name will work as well
  3. You can use other root-level directories in your repository, as in, have an app directory next to home. When calling shplug env add, it will try to create and link those files under /app on your machine. Make sure that this directory exists and owned by your user, otherwise shplug add env will fail due to lack of permissions to create a directory under /.
    • Another option is to run the command as a superuser while retaining your user's $HOME configuration. This might work but will definitely require further chown-s to fix the permissions on all the cloned files, hence ill-advised.

Plan on changing your scripts? Great!

You can edit any of your scripts and push them to your global git repository easily. After doing any changes, just enter the hidden git repo using: shplug env cd <env-name>, and interact directly with your git repository.

Easy plugins

Quickly and easily manage aliases, functions, gists and more. The plugin manager allows you to download files locally and automatically source them into your active shell.

Let's say a colleague wrote a small script to handle that annoying task that broke the integration tests at work. Just get him to upload it anywhere and run: shplug plugin add <plugin-name> <plugin-url>.

The name can be whatever you want. Here's an example: shplug plugin add git-describe https://gist.github.com/dtrugman/ec4d40e7b05f01251e4c688ae62219fd

You could argue you can just add this script to your dotfiles repo, but life's dynamic and unexpected. There are different reasons to keep those separated:

Install

shplug currently officially supports bash and zsh:

source <(curl -L "https://github.com/dtrugman/shplug/releases/download/v0.2.1/install")

Feature requests & Contributions

You are more than welcome to ask/do both!