Skip to content

Instantly share code, notes, and snippets.

@tnj
Last active October 15, 2015 08:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnj/23711bf9ad60e3a307b3 to your computer and use it in GitHub Desktop.
Save tnj/23711bf9ad60e3a307b3 to your computer and use it in GitHub Desktop.
Vagrant ssh-config cache wrapper for IntelliJ Vagrant plugin
#!/bin/sh
# This script is a quick hack/workaround for
# https://youtrack.jetbrains.com/issue/PY-12711
#
# Open settings and set this script as an alternative to `vagrant` command
# to minimize lag in Vagrant plugin of IntelliJ IDEA (RubyMine, etc.)
VAGRANT="/usr/bin/vagrant"
CACHE_BASE="/tmp/vagrant-ssh-config"
CONFIG_CACHE="$CACHE_BASE.$(pwd | md5)"
if [ "$1" = "ssh-config" ]; then
if [ ! -e "$CONFIG_CACHE" ]; then
$VAGRANT "$@" > "$CONFIG_CACHE"
fi
cat "$CONFIG_CACHE"
exit
elif [ "$1" = "up" ]; then
rm "$CONFIG_CACHE" 2> /dev/null
fi
$VAGRANT "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment