[Emacs] Emacs使用Tramp Mode访问远程文件

TRAMP (Transparent Remote Access, Multiple Protocols) is for transparently accessing remote files from within Emacs. TRAMP enables an easy, convenient, and consistent interface to remote files as if they are local files.

使用方法:直接按如下格式打开远程文件即可,

C-x C-f /ssh:username@server.net:path/to/file.txt RET
C-x C-f /ssh:username@server.net:path/to/directory/ RET

注:
sftp是Secure File Transfer Protocol的缩写,即安全文件传送协议。
Tramp Mode不支持sftp协议,在打开/sftp:username@server.net:path/to/file.txt时会提示:

byte-code: Unknown method "sftp"

原因:

This is problematic with hosting accounts where access is only via sftp… other protocols (such as ssh) are disabled.

解决方案:
如果服务器还支持ssh的话,可以使用/ssh:username@server.net:path/to/file.txt代替。


参考:
EmacsWiki: Tramp Mode
TRAMP User Manual - GNU

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容