Unifix knowledge database - The original oneDashboard - News - Search - List - About - Admin
remote editing ower scp in vim
created: August 27, 2003 11:10 complexity: intermediate author: Roberto as of Vim: 6.0 I'm frequently editing files remotely, but if the network traffic is tight, then a normal VIM session turns into a tortuous event. The solution to that was right under my nose: VIM's Network-Oriented File Transfers (:help netrw). Instead of editing the file remotely, it can be transfered from the host server, to a local copy, edited and then sent back when done. I know that you can do this manually, but it's a hassle, besides, if it can be done automatically, why not go for that? :) Assuming you have the following installed and properly configured: 1. VIM 2. netrw.vim (afaik comes in all recent vim installs) 3. scp, rcp, ftp or ftp+ Then to use, all you need to go is specify the protocol, user, host and path to the file you want to edit: vim scp://firstname.lastname@example.org//var/www/html/rtc_functions.php gvim scp://email@example.com//var/www/html/tips/add_tip.php Every time you write the file (:w etc.) the file will get copied over to the source and you will be brought back to your session for further editing. If you already have an open session, then just issue the following commands: To read/load up a file: :Nread scp://firstname.lastname@example.org//var/www/html/rtc_functions.php To write the file back: :Nwrite scp://email@example.com//var/www/html/rtc_functions.php That's it! You'll be editing at local speed.
Dashboard - News - Search - List - About - Admin
Powered by Mikjaer Consulting Solutions - Hosted by Specialhosting.dk