I've used vim for years and feel fairly proficient with it. However, recently, I've been working on a server with a 520ms ping time (Sydney to South Africa). This greatly increases my need to use vim more effectively. What can I do to help learn the shortcuts which thus far I've never learned?

5 Answers 5


To use vim more effectively, I would concentrate on learning more of the specialized movement commands (parens to move by sentence, braces to move by paragraphs). They can be combined with the editing commands (delete, change, etc.) once you are familiar with them. Also, learn the ‘a’ and ‘i’ combinations for selecting (and applying commands to) objects around the cursor (e.g. das to delete the sentence that the cursor is in: compare to (d), which has three Shift toggles). Learn to apply counts for larger movements (e.g. c2w to change the next two words, d2as to delete the sentence the cursor is in and the next one). Use marks to jump to frequently used spots.

I forgot one of my favorite movement commands: f/t/F/T move forward or backwards (lowercase or uppercase, respectively) to the next or just before the next (f or t, respectively) character you type: f* moves to to the next * to the right, T( moves just to the right of the next open parenthesis to the left (swap left and right for right-to-left configurations).

Making big changes

For repetitive edits, use the macro recording function q to record and @ to playback sequences of the same commands.

Use registers instead of copy and paste, it will save a round-trip (since macros are stored in registers, you can use the register store/retrieve commands to fixup errors in the macro without re-recording).

Use the :%s/…/…/g command to make global replacements/deletions.

And if you still can not get it to feel comfortable, you might be able to make edits via the netrw plugin: vim scp://target/somefile.

As akira notes below, this lets you run Vim on your local machine where latency is not a problem. When you edit a remote file, Vim copies it to your local machine. When you save, Vim copies it back to the remote machine. It supports many protocols (WebDAV, HTTP (read-only), FTP, SSH (scp, sftp), rsync).

  • 1
    this tiny little last paragraph is the most valuable answer so far. just to type less does not mean anything if between one key press and the next one are SECONDS. just to make it more clear: via 'vi scp://target/simefile' you edito on your own machine, locally and with ':w' you write to the server...
    – akira
    Feb 5, 2010 at 9:38
  • @akira: It does not directly address the actual question of how to become more efficient with Vim, so I just tossed it in at the end. If it is applicable to the OPs situation, I suspect that it will be one of the better solutions to the overall problem. Feb 5, 2010 at 10:05
  • 1
    I'd expect vim sftp://target/somefile to be more efficient than scp since sftp is really a distant open() call instead of transferring the whole file locally, and allows to write files by chunks.
    – raphink
    Feb 5, 2010 at 10:20
  • yah, true. but i know 'user' questions first hand and they mostly ask something with a problem in mind and they ask towards their own 'solution' .. in this case 'i must type less so the lag does not matter'. the topic itself would justify an answer covering only the netrw-solution imho, but since you posted it first, i want YOU to write that answer :)
    – akira
    Feb 5, 2010 at 10:22

Well, Vi was written for slow modem links, so Vi/Vim are possibly the best tools to use in this situation.

What I would suggest is to consider anything that you find yourself repeating, and write macros to avoid the repetition.

Use :map liberally, and (because it's Vim), the 'q' macro recording feature (:help recording).

Make use of repeat counts (as you have identified) and use motions to navigate (like searching and going directly to line numbers) rather than banging on h/j/k/l.

So things like 5d to go down 5 lines, } to reach the next empty line, Ctrl-I and Ctrl-O to go back/forward through recently-used positions in the text (:help jumps).

Also consider downloading the file(s) and editing locally, then uploading back to the server.


as others already wrote, vim was designed specifically with slow connections in mind, so you just need to learn to use it more effectively. you need to learn ( and know the difference between) a/A, f/t F/T, i/I, ^, $, o/O, p/P, d/D etc. they are all important and can save you quite a lot of movements.

But the biggest problem from my experience is psychological. you known that eventually it will be faster, but right now its faster (and more importantly easier on the brain :) just to use the cursor keys :).

What I did to learn effective vim is to "punish myself" every time I catch myself doing something inefficiently, by going back and re-doing it the right way anyway.

so for example if you just "caught" yourself moving 10 lines down with the cursor keys go back and then use smth like "10". or more importantly almost never using the horizontal arrow keys, use T,t,F,f,/,? instead. and "punish" yourself by redoing it again. you will start to do the right thing in no time.

oh, and another thing to watch is the visual selection mode. 99% its not needed as the same can be done differently.


Have you gone over the vim introductory tutorial? After that I highly suggest grabbing a vim cheat-sheet and making sure you at least know what each item in the cheat-sheet is referring to. Learn about using regular expressions in search and replace. Learn about recording and executing macros. Learn about visual mode and how you can "pipe" your selection into external commands and read data in from external command.

  • I've done the tutorial, and I used to have the cheat sheet on my desk. However, while I know a number of commands exist, I have a hard time remembering to use them. I have a number of bad habbits like typing xxxx instead of 4x.
    – brianegge
    Feb 5, 2010 at 7:33
  • 1
    @brianegge some things one only learns the hard way ... some more time on that remote machine and you will know better Feb 5, 2010 at 8:09

There is also an option called 'scrolljump' that controls how many lines to scroll when your cursor moves off screen. This can help reduce how much of the screen needs to be redrawn.

But the netrw plugin as mentioned by Chris Johnsen is an excellent solution, I used it many times to do development over incredibly slow and unreliable connections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.