Tips for using vim over a slow connection?

10,498

Solution 1

vi was created to use over 300 baud modem, that is why there is all those funny and strange (and short) command to move and navigate. Learn them...

Play with things like

 :10 -> jump to line 10
 7j -> move 7lines down

And since my keyboard has a little physical dot at the keys f and j, I use the dot on key j to easy find the vim navigation "hjkl".

But the best thing is to never ever scroll at all, search to move is a life saver. When you search your pointer ends up right at the thing you search for, meaning that those slow navigations is not needed. This is really useful if you end up editing really big files over ssh...

Solution 2

Few things to look into.

  • :he lazyredraw
  • :he ttyfast
  • :he nofsync

Solution 3

I think the best thing to do is edit it locally and transfer the file. This can be automated so that it feels like editing remotely:

http://vim.wikia.com/wiki/Editing_remote_files_via_scp_in_vim

See also the answers to this related question:

Remotely Programming

Solution 4

You can try setting off timeout and ttimeout, this way Vim will wait until either the complete mapping or key sequence has been received.

Or you can increase the timeoutlen value, this is the time in milliseconds waited for a key code or mapped key sequence to complete.

Solution 5

Over a slow connection, it's painful to move the cursor character by character, because you don't get immediate visual feedback, so you always end up moving too much or too little.

So what's most effective to me is to use smarter movements and commands, like:

  • fx -- jump to next letter x
  • 5w -- move 5 words forward
  • ci( -- replace what's between the parentheses
  • dap -- delete current paragraph
  • and a long etcetera.

I miss those commands all the time when typing in browser's textareas, like now :)

Share:
10,498

Related videos on Youtube

Paul Wicks
Author by

Paul Wicks

Updated on January 20, 2020

Comments

  • Paul Wicks
    Paul Wicks over 4 years

    I'm using vim over a slow connection and it is a little painful. Is there anything I can do in vim to alleviate the pain?

    • Johan
      Johan about 15 years
      How did it go? Did any tip here made your life easier? I'm a little bit curious :-)
  • Johan
    Johan about 15 years
    Sometimes the files is to big to be moved like that.
  • poundifdef
    poundifdef about 15 years
    @John Fouhy I'm not sure! When running script with both options, the resulting file with black and white has 50 fewer characters. It looks like it is sending another couple of bytes each time the color changes.
  • poundifdef
    poundifdef about 15 years
    (continued) I think the CPU is a lot more limiting, however. Running top while editing a long html file, CPU sometimes spiked to 100% with color (and was choppy), but did not approach that at all for no-syntax. (a purely unscientific study, of course!)
  • Tomato
    Tomato about 15 years
    Exactly right. I learned vi in order to participate in newsgroups over two transatlantic hops. I was able to carry on typing in the face of 5 second lag.
  • Olathe
    Olathe over 10 years
    I didn't know about :10. Thanks!
  • ruohola
    ruohola almost 4 years
    "Tips for using vim over a slow connection"
  • asgeo1
    asgeo1 almost 4 years
    What's your point @ruohola ? - read my answer in full, it's about diagnosing which Vim plugins perform poorly over a remote connection, and disabling them. In my experience, that's one of the biggest issues.
  • Philip Kearns
    Philip Kearns over 3 years
    Good. These are extensions of the old vi redraw option which I used to use when I was working on a dumb terminal over 1200 baud 30 years ago.
  • DmitrySandalov
    DmitrySandalov over 2 years
    Also tmux, as an alternative to screen. See tmux quickstart here.