Hacker News new | past | comments | ask | show | jobs | submit login
Graphical Vim Cheatsheet (viemu.com)
104 points by bry on Dec 14, 2010 | hide | past | favorite | 26 comments



Important VIM tip that cheatsheets never mention for some reason: text objects. First, remember these two things: a for a, and i for 'inner'. 'daw' deletes a word under the cursor. 'diw' deletes the contents of a word (the 'inner' of a word) under the cursor.

What? How is that useful?

'das' deletes a sentence under the cursor. 'dap' deletes a paragraph under the cursor.

'da{' deletes the block of text that's currently surrounded by braces. 'ci(' deletes the inner content that's surrounded by parentheses and puts you in insert mode. 'gqap' reformats the contents of the paragraph under the cursor ('gqip' will end up leaving your cursor at the beginning of the paragraph instead of the end.)


Here's a great SO comment describing how to work with text objects:

http://stackoverflow.com/questions/1218390/what-is-your-most...


I consider text objects and the f/t motions to be the core Vim editing motions. I'm always annoyed that vim intros go through teaching the w/e/b motions when you can easily get by with f<space>/t<space>/T<space> and the search commands generalize to things like replacing the first part of a camelCase word (ctC) or the end of a string (ct").


Working with text objects like that really boost the ability to work effortlessly ... and is, like you said, something the cheat sheet doesn't mention.

Then again, the cheat sheet leaves a lot out ... but it's the fundamental tool for a newcomer regardless... ideally, they should become intimate with ":help".


If you use emacs/viper, I recommend vimpulse: http://www.emacswiki.org/emacs-es/Vimpulse

This gives you text objects - and they are fantastically useful. It also gives you the saner window functions of 'C-w hjkl'


I've been trying to learn the emacs way of doing things, without resorting to Vim emulators, but this is really tempting.

One question, how well do these work with say Paredit mode? Paredit really hates it if you change a parenthesis via some other function. If they get unbalanced paredit has a seizure.


More information: :h text-objects


I've had that taped to my office wall since way back when I decided to use Vim. That, and the intermediate learning cheatsheets here were very useful. http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial...


Definitely be sure to give thanks to ViEmu for this great set of graphics, and if you happen to like Vim and use Visual Studio, give consideration to buying their plugin. It works incredibly well, and really helps me feel at home when writing software in Windows.


It's a good sign of ViEmu's quality that they provide the standard Vim cheatsheet without any editing. I haven't used ViEmu myself, but their emulation seems extensive -- impressive given how limited to the point of uselessness Vi-emulating "keybindings" are for other software.


I had Office Depot print this cheat sheet: in color, legal-sized, double-sided, laminated with a heavy/stiff plastic and spiral bound. It now sits off to the side of my desk and has made for an invaluable reference over the past year.


If you use Vim, snipMate is an awesome plugin to give you snippets.

http://www.vim.org/scripts/script.php?script_id=2540


Here's a nice article on how to set up VIM as a Python IDE: http://blog.dispatched.ch/vim-as-python-ide/


This cheatsheet was great when I started using vim years ago.

I highly recommend http://vimcasts.org/ It has neat little tutorials that cover a lot of vim's powerful features.


Does anyone know what sort of a license does this picture carry ? I want to 'reblog' this to my own blog, just for future reference..


Feel free to "reblog" a link to the GIF, but it would be best to link to the containing page:

  http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
You can blog an image hotlinking to the cheatsheet inside a link that points to the containing page for best effect.

Also of possible interest, the "why vi" article:

  http://www.viemu.com/a-why-vi-vim.html
I'm the author of both.


Thanks a lot for the prompt reply, and for letting me 'reblog' it. Appreciate it.


Seeing this makes me wanna use vi again.


You should! I've been an on/off Vim user for years, but only recently have finally decided to do all my editing in Vim and I can say that (after the typical initial re-learning curve) I'm more than happy.

This article in particular made me want to go back and try again, with a better Vim configuration file: http://nvie.com/posts/how-i-boosted-my-vim/

Now I've gotten so used to Vim, I keep closing tabs and chat windows when trying to delete a word I just typed (Ctrl+W on Vi). Awkward :)

EDIT: I linked the wrong article. Fixed now.


Also try FireFox with the Vimperator add-on.



Don't use vi, use vim.


Those come as stickers too, and make your laptop look really cool! I got mine from 4keyboard.


Sometimes I feel like I am the only one who just doesn't get VIM


Is there something like this for non-US keyboards?


Hahah. A graphical cheatsheet for a command line editor. Nice!




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: