Is there an efficient way to do remote editing over server using sublime Text 3? - terminal

I am writing some projects and need frequently compile and test on remote machine.
I am not a vim user thou :(
What I end up now is to use Fetch to browse the project folder and directly open those file using sublime by changing the default editor in Fetch. It somehow works, but one thing not perfect is that I cannot have a “project” structure in my sublime.
I am wondering anyone has a better way to use Terminal (or iTerm whatsoever) with sublime better.

Although this question is over two years old, I will try to answer it. Maybe it will be helpful for you or others that find it.
First, there is sshfs, which you can install via Homebrew or MacPorts. A simple approach would be as following:
mkdir -p ~/mnt/server
sshfs user#server.example.com:/path/on/server ~/mnt/server
Afterwards, you have the complete folder structure from server.example.com locally available at ~/mnt/server. Make sure you set up SSH keys to avoid entering the user password every time. You can find tutorials on that everywhere on the net.
For servers that only offer FTP access (shared hosting and the like), you can use curlftpfs in the same fashion.
To close the connection, simply unmount:
umount ~/mnt
For a GUI-based approach, you have several options. There is Transmit, which features mounting connections as volumes, Forklift which is a Finder replacement that can do the same, ExpanDrive and my favorite Mountain Duck.
If you plan to move lots of data, especially a lot of small files, Mountain Duck performs the best in my testing.

You could use TransmitFTP. Any FTP/SFTP/WebDAV/S3 server connection can be mounted as a volume, e.g., /Volumes/Example. Then you can browse to it when opening a folder in SB and add to your project like any other directory on your filesystem.

Related

Text editing files on a remote Raspberry Pi using local editor

I am currently required to connect to my university's system of password protected rasberry pi's where I have to edit files to complete weekly projects. I am very sick of using vim in order to edit these files and tried sshfs and rmate, but have not been able to get either of these to work properly. I simply want to edit the files on the rasberry pi system with something like Sublime instead of vim.
Also, I am using MacOSX if that matters at all for the solution.
Cyberduck lets you set any application you want as an editor, so you can set Sublime as the editor that way. That's the only way I've found that works in modern macOS. Downside is I don't think you can "edit" a directory this way, if that's what you were trying to do.
There's also the paid (w/ free trial available) app Mountain Duck for mounting SSH directories like SSHFS used to do. It seems fine except that it can't follow symbolic links.

Using WebStorm (JetBrains) with SSHFS mounted development server (Mavericks, OSXFUSE)? Constantly dismounts drive

UPDATE: I saw that someone was trying to use PyCharm with SSHFS and JetBrains said: "no". Perhaps this just won't work?
I'm trying to work with WebStorm on an SSHFS mounted disk at a client's office I'm working at — I've never used SSHFS before. I am using OSX 10.9.2, installed SSHFS thru home-brew and installed OSXFUSE.
The SSHFS mount dismounts periodically in any case, but since I started trying to use WebStorm with it it dismounts every time I start WebStorm and it starts scanning the files on the SSHFS disk — WebStorm gives the message "external file changes sync may be slow: Project files cannot be watched (are they under network mount?)" and if I try to open files it freezes. The SSHFS disc meanwhile has been dismounted. If I remount via terminal WebStorm isn't happy and either freezes or just sits there.
I set up the WebStorm project using "New project from existing files" — is there a way to set it up using SSHFS as a server? Beyond the login and password to the SSHFS disc I don't have any other server-specific info, but perhaps could get it.
Thanks for any help — 
This is how I operate, and maybe it can help you. If there's a config setting I seem to have glossed over, just ask and I'll fix this up. But all in all, this is wonderfully successful:
My build environment is tucked away on a Linux distro, but my development environment is co-located on a Mac Desktop (when I'm at work) and a Mac Air (when I'm at home). My projects are enormous, and contractually I can't move the code to any machine where it might be accessible if my laptop is stolen. So I pretty much have to use ssh (and sshfs) to get anything done.
When I am at home, and I sit down to work, I manually initiate the VPN -- since there are so many variations, I'll assume you know how to do this part.
I open a terminal and invoke:
caffeinate &
because I hate getting disconnected whenever the computer goes into screen saver. This may be why you get disconnected? I leave this terminal open whenever I'm developing. I also use tmux so that my terminal session can be shared between computers. Anyway...
I set up a mount point set up between the server and the client. I have a script that I run when the mount point goes down (customize for your own work):
umount -f /Volumes/$MOUNTDIR/
umount -f /Users/$HOMEUSER/$MOUNTDIR
mkdir /Users/$HOMEUSER/$MOUNTDIR
sshfs $HOMEUSER##SERVERADDR:/usr/$HOMEUSER/$MOUNTDIR /Users/$HOMEUSER/$MOUNTDIR
I then launch Webstorm, PyCharm, ADS, IntelliJ (I'm a Jetbrains fan).
At this point you can open the directory within $MOUNTDIR and start working. If you find that you need to run builds, here's a tip -- do not build locally. Instead use SSH to issue the build commands (or run scripts) on the server. The overhead of synching after the build has run is most likely far less than fetching and writing all of the steps of the build.
I only find I get disconnected if I lose the VPN. I used to get disconnected whenever the computer would sleep. Caffeinate fixed that.
For reasonable sized projects, this is probably all you need. So what follows is an optimization -- only do it if you are having headaches:
To speed up load times, what I do is create a local project that is not part of the mount. There is a .IDEA directory that gets created and written to a lot at the base of the first directory you open as a project. Inside of this directory are lots of files that get written to a lot, and depending on your network speed, it might cause grief. It does mean some settings have to be maintained everywhere you go, but in my case it's a small price to pay for big performance gains.
So because I do this, I'll have to manually add directories to my project (Under Preferences/Directories). But if you work with huge APIs, you might be doing this anyway. I am careful to mark directories I don't need to reference as 'excluded', to make life easier on the indexer. I work in a shared directory structure with thousands of other employees, and I make sure the streams don't cross.
Now I have many many thousands of files, and it is true that sync can be slow. But sync is only triggered when you leave the app and come back in. And honestly, it's not that terrible, so long as you have a reasonable internet connection.
I hope this helps. Once I started using this as my workflow, I never went back.

Moving files across a computers connected by LAN

I am needed to move entire directories from one computer in the network to the other (In a platform independent way). Basically I am working on some automation tool to help the developers do Build Verification Tests, for this; I am directed to automate the installation and un-installation of the product on multiple platforms. So, I will need to first copy the files!
And this is where I needed some help in both conceptual and practical knowledge.
Firstly, let me mention that using something like FileZilla or WinSCP is out of the question since I need things to happen automatically and not through button clicks. But please let me know if these tools have any command line utilities!
I tried Perl's NET::FTP, and while it looked promising, I was wondering whether it was the best way to go. Also, I want to know what are the pre-requisites before I can run FTP, I mean would I need perl installed on the other end as well ? I constantly read that the commands from perl's FTP actually try to connect to a FTP host, does this mean its not going to work if I haven't configured the remote host in some way? And if I am right, then what is this extra piece of configuration to be done?
Apart from this, is there any other way I could solve my problem ? I mean I am looking for API's here that would help me do platform independent file transfers. But once again, I cannot use tools that would need button clicks and stuff, because I am doing automation and everything needs be dome programmatic-ally and automatically.
Also, I think this is a very generic problem-statement: "Moving files across a computers connected by LAN"; So, it would be wonderful if we can have a list of (possibly) many options (ways to solve the problem) in the form of answers to this post.
Thanks in advance for any help that you wish to provide.
If nearly all of the files in your directory have changed, creating an archive, sending it over the network, and unarchiving makes sense. Actually, if your LAN is fast enough, though, it may be faster not to compress the archive--just use tar.
If only some of the files have changed, rsync, a command line tool, will only download the changes. It can be used with ssh like this:
rsync -ae ssh username#hostname:/path/to/files /store/here/locally
http://www.thegeekstuff.com/2010/09/rsync-command-examples/
On Linux and OS X, cron and crontab allow you to schedule scripts to run periodically. Windows provides the Windows Task Scheduler.
FTP is fine if you don't care about encryption over your LAN. Otherwise, SSH would be preferable.
rsync is available on OS X and Linux, but I think you can use it on Windows through Cygwin.
I suggest making an archive (e.g. a .tar.gz file) on the source host, transferring it with scp, and unarchive it on the target host.
You could also use unison or rsync
I would suggest you to develop your own FTP client in .NET. This way you will have complete control over the application, and instead of button-clicks you can schedule it using windows-scheduler. Here is an article about how to create your own FTP client in VB.NET:
http://dot-net-talk.blogspot.com/2008/12/how-to-create-ftp-client-in-vbnet.html

Textmate question: how to have a drawer when editing files online?

is it possible with Textmate to work remotely and using the sidebar drawer?
thanks
How do you do the "remote" part of your question? SSHFS? FTP?
If you use FTP (Transmit or Cyberduck) there is at least one way but I think it's extremelly convoluted. I used to want it badly when I started to use TextMate but I soon learned about Subversion and then Git and now, I almost never use an FTP client for development work at all.
Both versioning systems are extremelly well integrated with TextMate and the whole concept of working on a local copy and pushing only valid changes is vastly superior to using an FTP client to download a whole file in a temp folder, opening it with a local editor, saving the temp file, uploading it to the server.
If you use SSHFS or some other ways to mount the remote server you can use it as you were working with local file with the caveat that the whole thing can be maddening slow.
Did you try to edit the files within an SSH session in the terminal? Using Vim like that is actually very fast but it can lead to somewhat unpleasing situations when not done correctly.
I found myself:
Use Transmit 4+
Mount the server as image
drag the entire mount icon in textmate
done.

Best way to edit Linux server configuration files on Mac OS X?

I'm used to editing my remote Ubuntu server through SSH and Nano. I've tried using Vim and Emacs but since I don't manage the server frequently enough I never quite get the hang of it and end up forgetting the commands.
I use TextMate daily for programming and was wondering if there's any counter-recommendation against mounting the server's /etc/ folder locally using http://www.macfusionapp.org/ and creating a TextMate project containing /etc/ and editing all configuration files right within?
root would have to be used through SSH to allow editing of the /etc/ files so that makes me a little nervous. Is this a bad approach?
I sometimes use Cyberduck to remotely edit files. You can set up SFTP connections in Cyberduck, so you can connect to any remote machine to which you have SSH access. Cyberduck lets you use TextMate as an external editor, so you can set up the connection and start editing, and Cyberduck will automatically upload your changes.
(This is probably possible in other FTP clients like Transmission, too, but I personally use Cyberduck so I don't know much about other clients.)
There's nothing wrong with using MacFUSE, but I find the Cyberduck solution to be simpler.

Resources