Modify Remote Files with VIM's Built in FTP Plugin

Last updated: Jun 3, 2008

I can’t tell you how excited I am that I found out about this. Vim has a built in plugin to connect to FTP sites. What this means is that you can modify your web documents from vim without having to save the file and then FTP the file up to the server. With this plugin all you have to do is save your work and it is reflected on the server.

I know jedit and many other programs have this feature built in, but vim is by far a more robust programming editor than jedit when you get used to it. So i was very excited that this was built into vim as well.

If you are one of those guys that make quick edits in notepad, save the file, open your ftp program, type in your username/password and connect to the server and then transfer your files, this will save you tons of time. As you can have both the productivity of Vim with remote editing.

To edit a remote file with vim you can use:

vim ftp://username@yourdomain.com//the/path/to/yourfile.php

Now I know what you are thinking. I don’t always know the path to my files and it would be nice if I could get a directory listing or choose the files like I do when I use my FTP program.

No problem. The default ‘:e’ command wil open the current diretory. You can also open the root directory like this:

vim ftp://username@yourdoamin.com//

This will open up a directory listing. To open the folder just press enter.

vim directory

Bonus Tips

You can turn on vim’s syntax highlighting by using, :syntax on

vim syntax

If you have a dark backgound sometimes the syntax highlighting can be dark. To make it lighter tell vim, ‘:background=dark

Making GVim your Default Text Editor in Gnome

If you want line numbers you can use, ‘:set number’.

Use VI Functions in the Command Line

Happy programming!

Need to print shipping labels on your site?

Checkout my product RocketShipIt for simple easy-to-use developer tools for UPS™ FedEx™ USPS™ and more.

Get notified on new posts or other things I'm working on

Share: