Skip to content

Instantly share code, notes, and snippets.

@letelete
Created November 14, 2020 22:58
Show Gist options
  • Save letelete/36d0d73055dd7a16d6b2c55f3e3d94f5 to your computer and use it in GitHub Desktop.
Save letelete/36d0d73055dd7a16d6b2c55f3e3d94f5 to your computer and use it in GitHub Desktop.
Adds a vim plugin inside of the .vim/pack/plugins/start/<plugin-name> path and makes it a submodule to easily keep your plugins synced with the github repo initialized inside of the .vim/pack folder.
# $1 - A GitHub plugin's repository URL with a '.git' suffix.
vimadd () {
BUNDLE="" && [[ $1 =~ '\/(.+)\.git' ]] && BUNDLE=$match[1] || echo "Cannot match a repo name"
[[ -z "$BUNDLE" ]] && return 0
cd ~/.vim/pack
git submodule add $1 plugins/start/$BUNDLE
git submodule update --remote --merge
git commit -m "Add $BUNDLE plugin"
git push origin main
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment