Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
VIM Hacks (slideshare.net)
49 points by mace on Dec 11, 2009 | hide | past | favorite | 21 comments


http://github.com/c9s/Vimana referenced in there looks pretty neat. Installing Vim plugins the normal way is indeed a un-fun process.


I wonder how it compares to vim-addon-manager, which I've been meaning to try out.


basically, vimana inspect the archive content or script type to decide what to do.

makefile or rakefile will be supported later.


now they're supported. (makefile, rakefile and meta)


I always hate it when people say to use something like "Fh" to jump to the beginning of a section that starts with an 'h'. How much time will I waste thinking about whether or not there is or isn't another letter 'h' somewhere between the cursor and where I want to go? It's easy to construct examples like this after the fact, but it's not going to take me <1 sec to process the entire line for "are there any h's?"

Or am I in the minority here? Do people really think/code that way on a normal basis?


the f & t commands are more useful if they are composed with action commands. say, for example, I have used the method getNewObject, but then I realize that it's really supposed to be createObject. If my cursor is on the g, I can say ctOcreate<esc> (change the text between the cursor up to the character before the next O to read "create"). outside of vim, I have to move my cursor over to the O, backspace out the "getNew" and then type "create".

a nine character difference (or three if you have a delete-character command) doesn't sound like much, but it adds up & also breaks you out of your flow a little bit. I find myself doing refactorings other people wouldn't do, just because I know how to do them very quickly in vim, while others would be arrow-keying and back-spacing around forever.


The repeat commands are your friend: Fh without looking, followed by ; and , if you don't end up in the right place the first time.


Thanks, that helped a lot. I had been trying to repeat with "."; hadn't noticed how many different kinds of repeats there are.


In case you don't know about it, print this out:

http://www.viemu.com/vi-vim-cheat-sheet.gif


Yeah, I actually do that. If I see it's an "h" that I need to go back to, I'll do the "Fh". Sometimes it takes me more than one jump to go back though (if any other "h" are in the way).


The beginning of a "section"? "Fh" will move to the previous occurrence of "h" on the line your cursor is on.

If you want to move to the first occurrence of "h" on that line, use "0fh" (that's a zero, not the letter "oh").


I find that having to concentrate on that actually refocuses me. Sometimes my mind needs a rest and I do it the lazy way, but by-and-large it is an excellent habit.


I just would have used "b" to go backwards by words instead of characters. It's not optimal, but much more natural.


This is why i just do / or ?


Even if you're a vim god, read this just to skip to slide 52. It's hilarious.


this is the image on slide 52, provided for your convenience :)

http://www.terminally-incoherent.com/blog/wp-content/uploads...


404


Actual title is "Perl.Hacks.On.Vim".


FWIW, more than half of the content is general Vim.


slide 116 "bash-like" key mapping means emacs-like (right?)


oh the irony. VIM hacks presented in flash. You moron.




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

Search: