I'm trying to use Sublime Text 2 as an editor when I SSH in to my work server, and I'm stumped. I found this http://urbangiraffe.com/2011/08/13/remote-editing-with-sublime-text-2/ (among many other posts) that looks like it might help, but I don't follow it exactly, particularly with what values I should put in for the remote variable in line 5. I set "/Users/path/to/local/copy" to my local root directory, but I don't know if that's right or if there's more to do. Any thoughts? I'm on OSX10.8
相关问题
- JavaScript File Transfer SSH
- Why does this bash script work at console but fail
- How to run code in Sublime text 2 python
- SSH Fingerprint not authorized on Heroku after git
- (Scp - Permission Denied (Public Key) [closed]
相关文章
- Check if directory exists on remote machine with s
- Git Clone Fails: Server Certificate Verification F
- Test if File/Dir exists over SSH/Sudo in Python/Ba
- Can't access AWS CodeCommit with SSH
- Sanity check SSH public key? [closed]
- Spark EC2 SSH connection error SSH return code 255
- Use RSA with Eclipse Remote Systems Explorer?
- trouble getting sublime to execute with linux term
I know this is way old, but I have a really cool way of doing this that is worth sharing.
What is required in Conemu and WinSCP. These are simple instructions
Open WinSCP.exe and login to my desired remote server (I have
found that it's important to login before attaching ... ).
In the preferences for WinSCP - two settings to change. Choose Explorer type interface and rather than Commander - so you don't see local files. Unless you want to (but that seems like it would suck here). Set up Sublime as your default editor.
With ConEmu open, right click the tab bar and select the option
Attach to...
. A dialog box will open with your running applications. Choose, WinSCP and select OK. ConEmu will now have an open tab with WinSCP displaying your remote files.Right click on the WinSCP tab and choose
New console...
. When the dialog box opens, enter the path to the Sublime executable on your system. Before you pressStart
, In the box that saysNew console split
select the radio buttonto right
and set the percentage. I usually choose 75%, but you can customize this to your liking, and it can be changed later.Sidebar->Hide Sidebar
, and bam, you now have remote files in exactly the same manner as you would locally - with a few caveats of course that comes with editing anything remotely. WinSCP is lightening fast though.I have two monitors - left monitor display's Chrome browser, right monitor displays code editor. Also in
ConEmu
, I create another tab and ssh into the site I'm working on, so I can do things like rungulp
orgrunt
remotely and also manipulate files from the command line. Seriously sped up development.Here's a screenshot:
I am on MaxOS, and the most convenient way for me is to using CyberDuck, which is free (also available for Windows). You can connect to your remote SSH file system and edit your file using your local editor. What CyberDuck does is download the file to a temporary place on your local OS and open it with your editor. Once you save the file, CyberDuck automatically upload it to your remote system. It seems transparent as if you are editing your remote file using your local editor.
Depending on your exact needs, you may consider using BitTorrent Sync. Create a shared folder on your home PC and your work PC. Edit the files on your home PC (using Sublime or whatever you like), and they will sync automatically when you save. BitTorrent Sync does not rely on a central server storing the files (a la Dropbox and the like), so you should in theory be clear of any issues due to a third party storing sensitive info.
lsyncd seem to be nice alternative to the sshfs approach. If you use "-delay 0" it works in real-time.
I've been working on a project called GiySync. It still needs some work, but it's open source and I've been using it every day for a couple of years. I'm also working on a native OS X version I've called GitSyncApp
Right now it's OS X only but it should be easy to add support for Linux, and possibly Windows too.
It works by watching file system events and it uses to git to sync a project folder on your local machine and a server.
I tried the other solutions like osx fuse, Expand Drive, Transmit, several solutions that used rsync, etc. They all work 'OK' for small projects, but if you're working with a lot of code they did not work for me.
A lot of the file system options do caching to improve performance, which is fine, until it's not. Like if you're working with other people and someone else changes the files on the server.
I also ran into issues if I was on a flaky or slow network where I'd end up with empty files. Or file that didn't sync, then the caching got weird; hopefully you committed recently. Using git solves this problem because it checks each commit's integrity.
Two bonus features:
A solution that worked great for me - edit locally on Mac, and have the file automatically synchronized to a remote machine
Make sure you have passwordless login to the remote machine. If not, follow these steps http://osxdaily.com/2012/05/25/how-to-set-up-a-password-less-ssh-login/
create a file in ~/Library/LaunchAgents/filesynchronizer.plist, with the following content:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>filesynchronizer</string> <key>ProgramArguments</key> <array> <string>/usr/bin/rsync</string> <string>-avz</string> <string>/Users/USERNAME/SyncDirectory</string> <string>USERNAME@REMOTEMACHINE:~</string> </array> <key>WatchPaths</key> <array> <string>/Users/USERNAME/SyncDirectory</string> </array> </dict> </plist>
In a terminal window run
launchctl load ~/Library/LaunchAgents/filesynchronizer.plist
That's it. Any changes to any files in ~/SyncDirectory will be synchronized to ~/SyncDirectory on the remote machine. Local changes will override any remote changes.
This creates a launchd job that monitors SyncDirectory, and whenever anything changes there runs rsync to synchronize the directory to the remote machine.