[vox-tech] serendipity with vim

Bryan Richter btrichter at ucdavis.edu
Tue Jun 8 00:47:06 PDT 2004


Karsten M. Self wrote:
> on Fri, Apr 02, 2004 at 06:16:21AM -0800, Peter Jay Salzman (p at dirac.org) wrote:
> > heh.  at 6:15 in the morning, it blew my mind.  it took a few seconds to
> > register what was going on.
> > 
> > if anybody has any vim tips they'd like to share, i'd love to see a
> > thread of people's favorite vim tricks.
> > 
> > here's another one i learned just recently:
> > 
> > 
> > 1 one
> > 2 two
> > 3 three
> > 4 four
> > 5 five
> > 6 six
> > 7 seven
> > 8 eight
> > 9 nine
> > 
> > use line highlighting (shift v) and highlight lines 4, 5, and 6.
> > type "zf".
> > you've now "folded" lines 2, 3, 4, 5, and 6:
> > 
> > 1 one
> > +--  5 lines: 2----------------------------------------------------
> > 7 seven
> > 8 eight
> > 9 nine
> 
> You'll discover split screens RSN I suppose.

I use both frequently. :) I like folding for zooming around in a file
(z+<motion command> is nice) and just generally keeping my screen tidy.
Splitting screens is obviously best for viewing multiple files or two
parts of a file at the same time.

Here are three other things I have started using lately:

1. I use / and ? extensively for moving around (this is with incsearch
on). This even works for yanking, deleting, or selecting visual regions.
For instance, if I wanted to yank "This even works" from the last
sentence, I would put the cursor on "T", then type y/f<CR>. You can just
keep typing "for yan..." until it matches the right spot. 

2. lmappings. These are mappings that apply for insert mode, text input
after /,?,r, or basically any time you are editing a buffer or talking
about the stuff inside one. While using lmap directly doesn't seem to
work for me (?), keymap files use them somehow. By making my own keymap
file, I think I've found the best way to use Dvorak with vim. Typing
commands in Dvorak is a royal pain, since vim was designed for
qwerty-efficiency (even if qwerty wasn't)[1], and this lets me do
commands in qwerty and typing in Dvorak. 

3. ~.vim/after/syntax/ directory. I wasn't having any fun figuring out
how to customize syntax highlighting and formatting until I found out
that everything in this directory (e.g. ~.vim/after/syntax/c.vim) is
autmatically loaded _after_ the $VIMRUNTIME/* scripts are all run. Yay,
now I have custom foldtext, highlighting, colors, etc.

Tips 4-736: http://www.vim.org/tips/index.php   :-D

-Bryan

[1] I'm not invoking superiority here- I think some people have actually
shown qwerty isn't necessarily that much slower than Dvorak. I just like
the Dvorak idea better. :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : http://rod.livepenguin.com/pipermail/vox-tech/attachments/20040608/e88b64c9/attachment.bin


More information about the vox-tech mailing list