He’s definitely more of an Emacs fan (which is fine) and the thing I found interesting is how you work with remote servers - on Vim you don’t, you use the terminal to SSH into a remote server and then fire up the installed Vim there to edit files, but in this vid he’s saying with Emacs you ssh into the server from emacs and any files you edit you edit on -your- emacs on your local machine, not one installed on the server. This is interesting!
So does this mean Emacs has a ‘full’ terminal? And will it use my .bashrc or .zshrc automatically? I have lots of functions/aliases etc that I’d want to use. Would be cool if it can do this!
I’m using #doom-emacs and do SPC :term then I ssh into the server with my usual alias, then when there I navigate to the directory which contains the file I want to open. If I press escape and then SPC I am shown:
If I press . I am only shown my local files, but I want to open one of the files from the server - is there an easy way to do that after having navigated to the folder as I have above? Or can I only open a file as per the video where you must already know the file name and location and use the path while ssh’ing in (in which case it’s not much use to me as it’s much easier then just to ssh into the server normally).
I have never really explored the workflow in Emacs but I believe if you just open a terminal and ssh from there you will only have that terminal connected to the SSH session. Emacs has support for connecting (similar to VSCode) through TRAMP Mode which from my understanding will cause the normal “find file” etc to act on the remote file system.
On that note, I can recommend you look into using vterm, I have found it to be a much greater experience than M-x term.
You can enable it through .doom.d/init.el (it needs libvterm as well though).
Thanks @Hallski - I enabled vterm but it looks like it’s still not possible.
By the look of it you need to do something like this C-x C-f /remotehost:filename RET (or /method:user@remotehost:filename) which is just too cumbersome. Shame as otherwise this could have been a really nice feature…
Just to be clear, changing terminal was not related to remote editing. Just that I have found it to be a better terminal than the built in M-X term. Sorry if that was unclear.
I have never tried using it but was under the impression that you could connect emacs to the remote server and then over the same connection use that to open multiple files (or a terminal), similar to how VSCode Remote works. However, a quick google suggests that it might not be as seamless but at least some of it seems possible. It might require some fiddling to build the workflow you are after though.
In general, thinking of Emacs more like a platform to build your own editing experience might save some disappointment compared to VSCode which more of complete package out of the box (and more limited in terms of making it your own). Doom and Spacemacs offers a good middle ground imho where you have a lot of functionality out of the box but still retains the ability to override or extend anything.
From what I could find googling there doesn’t seem to be any out of the box solution that takes it as far as VSCode Remote though.
It depends a bit on what you want though, if you just want to open a remote file and make some changes what you can do in Emacs already should be good enough. Keep in mind that you can write some code to simplify steps you need to take often. Say if you always connect to the same server, you can make a function that will connect to that service and a specific directory and bind it to a key.