Background#
VSCode is increasingly favored by developers, and its killer feature is the Remote SSH remote editing function, which is also an important part of many people's remote laptop office workflow.
Of course, you can also achieve this in Emacs.
Effect#
Platform-specific#
Linux#
You can use it directly without any configuration.
C-x C-f /ssh:user@server:/
To avoid repeatedly entering passwords, it is best to configure key login for the server.
Windows#
First, install putty and add plink.exe to the PATH.
Use Emacs to edit files on the SSH server:
C-x C-f /plink:[email protected]:/tmp/
Add default information in the configuration, C-x C-f /-::
will use the default information to log in:
(custom-set-variables
'(tramp-default-method "plink")
'(tramp-default-user "root")
'(tramp-default-host "1.2.3.4"))
;; use /-:: to nav to default host
Add helper functions so you don't have to enter a bunch of information every time:
(defun ssh_123 ()
(interactive)
(find-file
(read-file-name
"Find TRAMP file: "
"/plink:[email protected]:/abc")))
When using private key login, you can first configure a login session with putty here, and then Emacs can use it directly:
C-x C-f /plinkx:putty_session_name:/
Terminal and File Browsing#
Opening eshell in the current directory will give you a remote host shell, and the file browsing (Dired) will also show remote files.