Skip to content
Vagrant method for Emacs' tramp
Emacs Lisp Shell
Branch: master
Clone or download
Latest commit 47c6fdc Aug 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Don't rely oon GNU head features Aug 22, 2017
COPYING Adds copying information Oct 15, 2015
README.md
vagrant-tramp.el Use plain completing-read instead of ido version Aug 16, 2019

README.md

#Vagrant TRAMP

Synopsis

vagrant-tramp adds an Emacs TRAMP method for Vagrant boxes. As far as Vagrant is concerned, the TRAMP vagrant method behaves like the built-in vagrant ssh command does. The vagrant-tramp method simply provides auto-completion and a wrapper around vagrant ssh for connecting to boxes.

Installation

If you have a recent Emacs with package.el, you can install vagrant-tramp from MELPA.

Or via el-get

Otherwise add it to your emacs load-path.

Usage

The TRAMP method vagrant uses vagrant global-status to get a list of running Vagrant boxes for completion:

C-x C-f /vagrant:

Find file: /vagrant:
-> devbox:
   esxbox:
   kafka-broker1:
   kafka-broker2:
   kafka-zookeeper:

Boxes are named using the Vagrantfile directory basename and the VM name (excluding default) to support multi-VM environments. TRAMP opens a connection by cd-ing into the Vagrantfile directory and running vagrant ssh $box_id.

Opening a file as root

Use this trick from the Emacs Wiki, where we replaced "ssh" with "vagrant" and where "box" is a Vagrant box name:

C-x C-f /vagrant:box|sudo:box:/path/to/file RET

vagrant-tramp-term

The vagrant-tramp-term function provides a convenient way to vagrant ssh into a box using an ansi-term.

M-x vagrant-tramp-term

vagrant ssh to box:
-> devbox:
   kafka-broker1:
   kafka-broker2:

See also

You can’t perform that action at this time.