#Vagrant TRAMP
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.
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
.
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
.
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
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: