7 ms·
Of all the "Vim tricks" article I came across, this one is my favorite so far. I have been a vim power user for a little over 2 years now. I never bothered ins
by babarock 15y ago
Of all the "Vim tricks" article I came across, this one is my favorite so far.
I have been a vim power user for a little over 2 years now. I never bothered installing plugins and spent all my time instead learning ... the exact same commands described in the article. Now I type fast, I mean real fast.
A couple more tips I find useful:
- 'gg' and 'G' in command mode will send you to the beginning and the ending of the file.
- 'Ctrl-N' and 'Ctrl-P' in insert mode will auto-complete (suggestions only come from existing words in opened buffers, for more you'd probably need plugins).
All the other tips are _spot on_! I especially like the first one about moving vertically one line at a time. It takes some time getting used to, but the fact that you can repeat the 'jump' or jump back to your previous position. Believe me, you'll fly :)
My new set of advice for blazing fast typing:
1. Learn to touch type. The rest is meaningless without this.
2. Repeat 'vimtutor' religiously for 10-15 days.
3. Read this post and apply every tip until it's hard-written in your fingers' muscle memory.
4. ... voila!
- nimrody 15y agoIn case you missed it, this one will teach you much more than just a few commands... It's all about combining commands or producing 'sentences' as the author calls it: http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-nouns-and-modifiers/ http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-n...
- graywh 15y agoDiscussion on HN: https://news.ycombinator.com/item?id=3361993 https://news.ycombinator.com/item?id=3361993
- graywh 15y agoThere's an option to configure how keyword completion works when ctrl-p or ctrl-n is used: 'complete'. Vim can scan the current buffer, other windows, other buffers, dictionaries, spell checking, thesaurus, included files, tags.
- dwc 15y ago> I never bothered installing plugins and spent all my time instead learning This wisdom should be shared with everyone learning vi/vim, since this leads directly to the largest payoff.
- derwiki 15y agoI dunno, Command-T was a pretty big boon to my productivity (https://github.com/wincent/Command-T https://github.com/wincent/Command-T).
- leviathan 15y agoThe general idea is that if your productivity relies on external plugins, it will drop very low as soon as you have to use someone else's machine, or when you have to work with lots of various systems where setting up your environment isn't an option.
- ulisesrmzroche 15y agoI think it's more that everyone is taking the bus to Abilene. Can you explain the first point a bit more? On the second point, you can always :e scp if you need to. I've never maintained my own .vimrc, or know what plugins I have installed or not, btw.
- dwc 15y agoI don't mean to say that you shouldn't find and use plugins, because there are some really great ones that answer real needs. But it seems that a lot of people new to vim get distracted by plugins, tweaking their config, et al, when they could be learning the "vi way" to get their actual code editing productivity.
- wahnfrieden 15y agoI disagree to some extant. I've been a power use for more than a decade and some of the default ways of doing things are just wrong. It is true though that people are reluctant to learn about what vim itself already provides - more people should use the fantastic help system (once you know the basics) rather than rely on blog posts for everything, too.
- scott_s 15y ago'gg' and 'G' in command mode will send you to the beginning and the ending of the file. I've always used ':1' for the beginning and ':$' for the end. To me, the benefit of this is that I always use the same mechanism to go to a particular line of a file. (I often do, say, ':45' if an error is reported at line 45.) For moving up and down large distances, I also prefer ctrl+u for up and ctrl+d for down. There is a minor difference: ctrl+f will put the last line at the top of the screen, filling the rest with the tilde-abyss. That always bothers me.
- jdludlow 15y ago45G does the same thing as :45, so the people using gg and G can also remain consistent with their muscle memory.
- graywh 15y agoThe reason for that difference between ctrl-d and ctrl-f is that one moves the cursor half a page (or 'scroll') and the other scrolls the screen one page.
- edanm 15y agoI like the idea of :1 and :$, but how do you get it to work in conjuction with selections (visual mode)? If I want to select the entire contents of the file, hitting "v" then ":1" seems not to work.
- c4n4rd 15y agoa useful one is 'markers'. I use it a lot when jumping from place to place. Example: :ma <-- sets a marker at the current cursor location named 'a' later on, you can go back to this exact place by typing "a (that is quote followed by letter 'a' - the marker you named. Note that you can have as many markers as you want.
- Nick_C 15y ago> Example: :ma <-- sets a marker at the current cursor location named 'a' You don't even need the leading colon, just ma while in normal-mode.