{"id":150,"date":"2015-03-15T00:00:54","date_gmt":"2015-03-14T23:00:54","guid":{"rendered":"http:\/\/kurt.www.pinboard.jp\/blog\/?p=150"},"modified":"2015-03-14T10:55:21","modified_gmt":"2015-03-14T09:55:21","slug":"remote-files","status":"publish","type":"post","link":"http:\/\/kurt.www.pinboard.jp\/blog\/kurt\/150\/","title":{"rendered":"remote files"},"content":{"rendered":"<p>Most of my machines are headless, they do not have a monitor attached. Vim usually is installed on all of them, gvim is not. But occasionally I prefer to edit certain files in gvim rather than vim or edit the same file on different machines in one editor instance.<!--more--> So wouldn&#8217;t it be nice if I could open remote files directly from my workstation? Sure, no problem. Vim does support opening remote files. For example, using scp:<\/p>\n<pre style=\"background-color: lightyellow; color: green;\">gvim scp:\/\/root@server2\/\/etc\/fstab<\/pre>\n<p>Note the double slashes after the hostname. With only one slash you&#8217;d be using a path relative to the $HOME directory of the remote user. Just think that the colon which would usually be used with the scp command needs to be replaced with a forward slash.<\/p>\n<p>The same also works with opening files from within an already running editor session:<\/p>\n<pre style=\"background-color: lightyellow; color: green;\">:e scp:\/\/root@server2\/\/etc\/hosts<\/pre>\n<p>I&#8217;ve only ever used this with the <code>scp<\/code> and <code>sftp<\/code> methods, but it should work with several more:<\/p>\n<ul>\n<li>dav<\/li>\n<li>fetch<\/li>\n<li>ftp<\/li>\n<li>http<\/li>\n<li>rcp<\/li>\n<li>rsync<\/li>\n<li>scp<\/li>\n<li>sftp<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Most of my machines are headless, they do not have a monitor attached. Vim usually is installed on all of them, gvim is not. But occasionally I prefer to edit certain files in gvim rather than vim or edit the same file on different machines in one editor instance.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[22],"_links":{"self":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/150"}],"collection":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":2,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":195,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions\/195"}],"wp:attachment":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}