News for hackers. Stuff that matters.
Re:Vim anti-patterns by nfm on Tuesday February 07, 2012 @03:51PM (#3563577)
zt, zz and zb are great too. They redraw the screen so that the line the cursor is currently on becomes the top, middle, or bottom line of the window.
Re:Vim anti-patterns by Jach on Tuesday February 07, 2012 @05:15PM (#3563884)
Other "z" commands (these are the ones I always get mixed up):

    :setlocal spell spelllang=en_us - turn on spell check
    z= - bring up list of suggestions
    zg - add word to dict
    zug - undo add to word
    zw - mark as wrong
    zuw - undo wrong
    :help fold
    zf<motion> - create fold (common motions '%', 'a{', 'a(' )
    zo - open fold
    zA - open folds recursively
    zc - close fold
    zd - forget fold
    zj - move to next fold
    zk - move to prev fold (up)
Re:Vim anti-patterns by Nick_C on Thursday February 09, 2012 @12:01AM (#3569900)
Some simple mnemonics might help you out.

  zg   g = Good word, add to personal dict
  zug  Undo Good word.
  zw   obviously, Wrong word.
  ...
  zo   Open
  zA   open All
  zc   Close
  zj   uses the same movement as the j key
  zk   ditto
Once you have the mnemonics sorted, sometimes you find you can remember the others because they are the ones "left out" of those with mnemonics, like zd doesn't have a mnemonic, so the command left over is "forget fold", so zd is that one. After a while, muscle memory takes over.
Re:Vim anti-patterns by re_todd on Tuesday February 07, 2012 @09:15PM (#3564703)
Yeah, I like the fold commands, which I barley discovered a few weeks ago. I typically do "set foldmethod=indent" then pres "zr" multiple times until I'm at the fold level I want. Then I can just do "zo" on the parts of code I'm interested in.
Re:Vim anti-patterns by jamesrcole on Wednesday February 08, 2012 @05:47AM (#3566037)
there's also

zR - Open all folds

zM - Close all folds

zO - Open all folds under the cursor recursively

zC - Close all folds under the cursor recursively

zX - Undo manually opened and closed folds: re-apply 'foldlevel'.

Re:Vim anti-patterns by malingo on Tuesday February 07, 2012 @06:29PM (#3564202)
I'm a big fan of Ctrl-e and Ctrl-y which, despite being in the "one line at a time" category, are really useful for changing the context of the cursor a little bit without changing the cursor's line. I've even gone as far as to remap those to J and K.
Re:Vim anti-patterns by Ziomislaw on Tuesday February 07, 2012 @06:37PM (#3564223)
thanks! I knew zz 'centers the screen'. you made it a lot clearer ;p