diff --git a/CHANGELOG.md b/CHANGELOG.md index 443d3bf..b7613e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Basics: [Marks?](README.md#marks) - Tips: [Saner command-line history](README.md#saner-command-line-history) +- Usage: [Editing remote files](README.md#editing-remote-files) - Debugging: [Verbosity](README.md#verbosity) - Debugging: [Debugging Vim scripts](README.md#debugging-vim-scripts) - Debugging: [Debugging syntax files](README.md#debugging-syntax-files) diff --git a/README.md b/README.md index a31a1ff..bdaf057 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ added every day. Things about to be added can be found here: - [Clipboard theory (Windows, OSX)](#clipboard-theory-windows-osx) - [Clipboard theory (Linux, BSD, ...)](#clipboard-theory-linux-bsd-) - [Clipboard usage](#clipboard-usage) +- [Editing remote files](#editing-remote-files) - [Managing plugins](#managing-plugins) - [Block insert](#block-insert) @@ -636,6 +637,42 @@ Vim comes with a pretty extensive documentation: :h gui-selections ``` +#### Editing remote files + +Vim comes with the netrw plugin that enables editing remote files. Actually it +transfers the remote file to a local temporary file via scp, opens a buffer +using that file, and writes the changes back to the remote file on saving. + +This is extremely useful if you want to use your local configuration opposed to +ssh'ing into a server and use whatever the admins want you to use. + +``` +:e scp://bram@awesome.site.com/.vimrc +``` + +If you have a `~/.ssh/config` set up already, this gets used automatically: + +``` +Host awesome + HostName awesome.site.com + Port 1234 + User bram +``` + +Assuming the above content in `~/.ssh/config`, this works just as well: + +``` +:e scp//awesome/.vimrc +``` + +Make sure to read `:h netrw-ssh-hack` and `:h g:netrw_ssh_cmd`. + +--- + +Another possibility is using [sshfs](https://wiki.archlinux.org/index.php/Sshfs) +which uses [FUSE](https://en.wikipedia.org/wiki/Filesystem_in_Userspace) to +mount a remote filesystem into your local filesystem. + #### Managing plugins [Pathogen](https://github.com/tpope/vim-pathogen) was the first popular tool for