30
30

More than 5 years have passed since last update.

Vagrant 内のコードを、ローカルの SublimeText で編集したい

Last updated at Posted at 2013-09-03

下記設定で、Mac と Vagrant 環境でファイルが共有される

synced_folder を使う(複数指定可)

  config.vm.synced_folder "[host_file_path1]", "[gust_file_path1(vagrant)]", nfs: true
  config.vm.synced_folder "[host_file_path2]", "[gust_file_path2(vagrant)]", nfs: true
  config.vm.synced_folder "[host_file_path3]", "[gust_file_path3(vagrant)]", nfs: true

以前の方法(Sublime SFTPを使ってた)

Vagrant 側の準備

  • vagrant ssh
  • git clone hoge しておく ★A

ローカルの設定

  • Sublime SFTP パッケージをインストール

    • http://wbond.net/sublime_packages/sftp
    • Trial で無料で使えるけど、有料(16$)。購入するとメールに書いてある設定をするとポップアップがでなくなるみたいです。
  • SublimeText でプロジェクトフォルダを右クリック、SFTP/FTP -> Map to Remote すると sftp-config.json が生成される。

sftp-config.json の編集

  • "upload_on_save": true, // 保存時にファイルを送信してくれる
  • 下記項目を vagrant ssh-config などを参照して設定する
    • "host": "127.0.0.1",
    • "user": "vagrant",
    • "port": "2222",
    • "remote_path": "/home/vagrant/hoge/", // ★A で指定したパス
    • "ssh_key_file": "~/.vagrant.d/insecure_private_key",
30
30
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
30