美文网首页Other
[Emacs] Emacs使用Tramp Mode访问远程文件

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

作者: 何幻 | 来源:发表于2016-05-11 13:32 被阅读873次

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

相关文章

网友评论

    本文标题:[Emacs] Emacs使用Tramp Mode访问远程文件

    本文链接:https://www.haomeiwen.com/subject/yqhurttx.html