Usage: editing remotes files

This commit is contained in:
Marco Hinz 2016-01-09 15:34:29 +01:00
parent fba68810f6
commit bb66b9a3cb
2 changed files with 38 additions and 0 deletions

View File

@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- Basics: [Marks?](README.md#marks) - Basics: [Marks?](README.md#marks)
- Tips: [Saner command-line history](README.md#saner-command-line-history) - 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: [Verbosity](README.md#verbosity)
- Debugging: [Debugging Vim scripts](README.md#debugging-vim-scripts) - Debugging: [Debugging Vim scripts](README.md#debugging-vim-scripts)
- Debugging: [Debugging syntax files](README.md#debugging-syntax-files) - Debugging: [Debugging syntax files](README.md#debugging-syntax-files)

View File

@ -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 (Windows, OSX)](#clipboard-theory-windows-osx)
- [Clipboard theory (Linux, BSD, ...)](#clipboard-theory-linux-bsd-) - [Clipboard theory (Linux, BSD, ...)](#clipboard-theory-linux-bsd-)
- [Clipboard usage](#clipboard-usage) - [Clipboard usage](#clipboard-usage)
- [Editing remote files](#editing-remote-files)
- [Managing plugins](#managing-plugins) - [Managing plugins](#managing-plugins)
- [Block insert](#block-insert) - [Block insert](#block-insert)
@ -636,6 +637,42 @@ Vim comes with a pretty extensive documentation:
:h gui-selections :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 #### Managing plugins
[Pathogen](https://github.com/tpope/vim-pathogen) was the first popular tool for [Pathogen](https://github.com/tpope/vim-pathogen) was the first popular tool for