Hacker News new | past | comments | ask | show | jobs | submit login
Best of Vim Tips (rayninfo.co.uk)
273 points by adulau on Feb 25, 2012 | hide | past | favorite | 26 comments



I find that terse resources like this (and for example Code Like a Pythonista: Idiomatic Python[1]) are the best learning resources. A true goldmine.

[1]: http://python.net/~goodger/projects/pycon/2007/idiomatic/han...


Agreed. But this page could certainly make use of some whitespace, to be more readable.


The PDF linked at the bottom is a little more palatable.

http://gav.brokentrain.net/projects/vimtips/vimtips.pdf


Page is best viewed in VIM.


Agreed as well


This has been my primary means of learning vim.

Most of the web resources I've learnt from have been verbose and gradually introduced new ideas (i.e. the advanced bash scripting guide, or any of Steve's rants).

I've been hooked on OP for it's terseness and challenging obscurity; which I guess suits the subject matter.


An awesome way to learn new tricks is to hack with another vim user


Or vim golf if there are no users nearby.


I believe this is the worst Vim Tips compilation I have ever seen. Utterly complicated commands with no real life examples. Also doesn't explain the difference between commands, motion commands and selectors. Which are crucial to the starter Vim user.

If you are an experienced Vim user, this might be a handy cheat sheet. If you're new to Vim, go look somewhere else.


Most of these are very useful and definitely real-world examples. I agree it's not for total beginners, but the page never makes such a claim.


I think the parent was asking for real world usage examples over contrived tom/dick/harry examples.


Taking each of the tips on this page and expanding on them to make them more suitable for beginners might actually make for pretty good and useful project.

Anyone want to take it up?


Can you provide a link to something better? As a novice VIM user I can't get enough of these resources.


A bunch of things I like, in no particular order.

Vimcasts: http://vimcasts.org/ (And keep your eye out for Drew's forthcoming book: Practical Vim.)

Vim University: http://vimuniversity.com/

Coming Home To Vim: http://stevelosh.com/blog/2010/09/coming-home-to-vim/

Efficient Editing With Vim: http://robertames.com/files/vim-editing.html

Why, oh WHY, do those #?@! nutheads use vi?: http://www.viemu.com/a-why-vi-vim.html

Your problem with Vim is that you don't grok vi: http://stackoverflow.com/a/1220118/26702

Vim anti-patterns: http://blog.sanctum.geek.nz/tag/anti-patterns/


Beginners should really start with vimtutor (just type "vimtutor" in your shell), and go through it a couple of times.

This is also useful:

http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial...

And when you're done with those, come to #vim on freenode. You can learn a hell of a lot about vim by just idling there. Of course, you'll learn even faster by asking questions.


This is something to skim and spot bits you didn’t know, leading you to the relevant bit of the fine manual. It has errors though, e.g.

    /\<\d\d\d\d\>   : Search for exactly 4 digit numbers
    /\D\d\d\d\d\D   : Search for exactly 4 digit numbers
    /\<\d\{4}\>     : same thing
The middle one is not the same as the other two since \D has to match something unlike the zero-width assertions of \< and \> for beginning and end of word.


The only thing I have hated about learning vim, is the god awful styling of every resource related to it. Every article or piece of documentation is a big wall o' text with no effort put into styling or separating content. This has surprised me since I don't believe that the set of competent designers and vim users are mutually exclusive.



This cheat sheet is horrible. Subjectively and objectively:

* Bold fonts everywhere without enough vertical space: bold is for important stuff, not for copy text and the lack of vertical spacing makes the whole thing hard to parse.

* Keychars centered vertically instead of placed on a common baseline.

* Meanings of keys centered horizontally: considered very hard to read since forever.

* No explanation for `WORD`: is it for uppercase words? (yes, I know the answer)

* Instead of being logically grouped, the commands and motions are tied to the spatial location of their key: the logic and grammar behind most of Vim is hidden in profit of an opaque, maximalist and almost unreadable mess.

* Focus is put on raw memory instead of intelligence and acquiring instant exhaustive knowledge instead of learning naturally.

* QWERTY is only one of many keyboard layout standards: a lot of the keys represented here are located elsewhere in french AZERTY or other layouts. This has one important consequence: the physical location of the keys bound to each command/motion is not linked at all to the name of the command or its mnemonic or to anything relevant. Because `A` can be anywhere, learning the physical location of "Append at eol" on this specific keyboard layout or on any other makes no sense at all.

But we obviously don't all learn the same way.


This cheat sheet is not "objectively" horrible. If it were, that would mean there can't be any debate about it being horrible. However, there is a debate, which anyone can prove by providing a single counterexample, such as this one: I personally believe the cheat sheet is not horrible. Yay, it's not objectively horrible, QED.

I don't mean to single you out. It's just that I find it really frustrating when people state their views as objective fact (and I'm often guilty of this too as I can be very opinionated, but I try to avoid it when I notice), so the above is just my request for us to isolate actual objective fact from opinion and to discuss our opinions using constructive language instead of destructive language. "I don't actually like that because of reasons x, y, and z" does a lot more to foster an exchange of ideas and possibly change someone's view than "Your idea is horrible. Here's why... ."

As for the actual cheat sheet, I don't know much about typesetting, but I think the author put the meanings of the keys to the right of the key symbols to make room for the section below the keyboard. Since I use a QWERTY layout, I have no need to scan the key symbols, so this horizontal arrangement of key symbols and then meanings doesn't hinder my ability to visually scan the image for content. I can imagine you're right that this cheat sheet is of less use to non-QWERTY users, but that isn't applicable to me.

What's great about this cheat sheet is its division of commands that can be combined with motions and text objects (it calls these commands "operators") and those that don't, also indicating which ones change the mode from normal to insert and which ones don't. It doesn't have an explanation for "WORD" because this isn't a tutorial. This is a cheat sheet. It's great for people who've already taken a tutorial on Vim and are working on developing the muscle memory needed to use Vim proficiently. One quick glance and you now know it was `w' and `W' that went forward a word, and either you remember how each defined word or you look it up in Vim's help. But you know what to look up now. You don't have to leaf through hundreds of lines of text in a tutorial. You look at this cheat sheet for 10 seconds and you realize your tutorial never taught you f and t. You look them up and you're now 10% more efficient with Vim.

This cheat sheet shines in its use as a reference (as a "cheat sheet") for refreshing your memory on things that you learned just slightly too long ago to recall easily, and it's also great for filling in the gaps and making sure you learned most of the important Vim keybindings. The cheat sheet doesn't go into text objects, but the same author addresses them here <http://www.viemu.com/a-why-vi-vim.html>.


Whenever someone mentions that they want to learn Vim, I send them this tutorial. It's the only one none of them have ever complained about. And from first-hand experience it's as useful for intermediate users as it is for beginners.


I think that the best way to learn vim is the understanding that, more than a text editor, it is a text editing language, derived from vi and ex. It has commands (d,c,y) and parameters for the commands (1,2,3..., f,t, a, i, /regex/). It also has means of abstractions (macros, .vimrc) and variables (registers). It's like a touch-typing dsl for text editing. This is one of the best explanations of this that I've found: http://stackoverflow.com/questions/1218390/what-is-your-most...


I found this is an attractive and well thought-out resource for understanding vim motions: http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wal....


I feel like that about Java.


I don't know how many times I've hit this link from random googling.

Just like this sed one liners: http://www.eng.cam.ac.uk/help/tpl/unix/sed.html


very nice, what I particularly liked was :

d/fred/ :delete until fred

y/fred/ :yank until fred

c/fred/e : change untill fred

I actually prefer this over ctf, dtf as it scales better




Consider applying for YC's first-ever Fall batch! Applications are open till Aug 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: