Using vim to edit remote files
As I know there are many editors out there that can edit remote files, I figured I'd find out whether my favorite editor supported that feature. Of course it did
. Just use
to locate the file, enter the password and happily edit away. Every :w will upload the file anew. This also works with at least scp:// , so there's no need to install an ftp server.
One small inconvenience is the fact that if you're NATed behind a firewall, you need to use ftp PASV mode, which is not the default setting for many ftp clients. However, Google brought an easy solution: add
to your ~/.vimrc. This latest tip thanks to: http://alecthegeek.wordpr...etrw-in-ftp-passive-mode/
ftp://user@server/path/to/file
to locate the file, enter the password and happily edit away. Every :w will upload the file anew. This also works with at least scp:// , so there's no need to install an ftp server.
One small inconvenience is the fact that if you're NATed behind a firewall, you need to use ftp PASV mode, which is not the default setting for many ftp clients. However, Google brought an easy solution: add
let g:netrw_ftp_cmd="ftp -p"
to your ~/.vimrc. This latest tip thanks to: http://alecthegeek.wordpr...etrw-in-ftp-passive-mode/
edit:
Note that the above indicates a relative path on the server. If you want an absolute path, you need to add an extra /: ftp://user@server//absolute/path/to/file
Note that the above indicates a relative path on the server. If you want an absolute path, you need to add an extra /: ftp://user@server//absolute/path/to/file
01-'09 De Vrienden van Amstel Live
12-'08 Nieuwsartikelen niet goed lezen, maar er wel op reageren
Comments
Thanks for sharing! I didn't know this but editing files over scp can safe me some time here and there.
Nice! Didn't know that one.
I mostly develop on the remote machine or I develop on a local installed development machine (and ftp/scp it when i'm done). But it can be very handy when you want to edit a remote file quickly. Thanks for the tip!
I mostly develop on the remote machine or I develop on a local installed development machine (and ftp/scp it when i'm done). But it can be very handy when you want to edit a remote file quickly. Thanks for the tip!
VIM supports everything. Too bad that when you really want to use al the features present, you cannot escape from the command line. And then you need to know which features are present and what the syntax is...
Too bad. The only thing preventing VIM to take over the world!
Too bad. The only thing preventing VIM to take over the world!
But if the file you're editing is located on a computer you have ssh access to... then why bother? Chances are high vi(m) is installed on the remote systemEverywill upload the file anew. This also works with at least scp:// , so there's no need to install an ftp server.
@Motrax: I'm not sure but have you tried xvim?
@Erik: that is true, but sometimes only a 'different' or limited vi(m) is available, in which case I prefer my local version, with proper settings, highlighting, etc. (I'm specifically thinking of the Solaris 9 machines over here).
Cool, always nice to learn a new vim trick.
Confusion, did you know you can import a dutch ispell dictionary to use in vim? I found that particularly useful, since I am writing most of my documents using vim.
Confusion, did you know you can import a dutch ispell dictionary to use in vim? I found that particularly useful, since I am writing most of my documents using vim.
Comments are closed