Skip to content

Instantly share code, notes, and snippets.

@neptaco
Created May 13, 2019 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neptaco/580e212d0c508a440a77f175990ff55f to your computer and use it in GitHub Desktop.
Save neptaco/580e212d0c508a440a77f175990ff55f to your computer and use it in GitHub Desktop.
fast vagrant ssh
function vagrant
set config ".vagrant/ssh_config"
set cmd (which vagrant)
if [ $argv[1] = 'ssh' ]
pushd . > /dev/null
while not test -e Vagrantfile; and [ $PWD != '/' ]
cd ..
end
if [ $PWD = '/' ]
echo 'Not found Vagrantfile'
else
# make ssh_config
if not test -e $config
$cmd ssh-config > $config
end
# ssh vagrant
if test (count $argv) -gt 1
/usr/bin/ssh -F $config $argv[2..-1]
else
/usr/bin/ssh -F $config default
end
end
popd > /dev/null
else
$cmd $argv[1..-1]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment