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?
|
feedback
|
|
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. I forgot one of my favorite movement commands: For repetitive edits, use the macro recording function 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 And if you still can not get it to feel comfortable, you might be able to make edits via the netrw plugin: 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). | |||||||||||
feedback
|
|
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 ( 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 Also consider downloading the file(s) and editing locally, then uploading back to the server. | ||||
|
feedback
|
|
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. | |||
|
feedback
|
|
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. | |||||||
feedback
|
|
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. | |||
|
feedback
|