5:15, Thursday November 27th, 2003 • feeling webmasterly • no comments
Or "My customers can't find anything on my site!"
A very tricky problem in web design is how to organise the information on the site into categories. Card sorting solves this problem in a way that's really pretty obvious.
You write out the items you're going to have on the site on cards (assume for a moment we're just talking about a bunch of simple documents you want to publish). Then you take that stack of cards and ask a customer to group them for you. Take a note of what they do, then go see another customer and ask them. Do this with a few customers, the client and maybe some other people and then look what consensus arises.
5:25, Wednesday November 26th, 2003 • feeling relaxed • no comments
# Recording (BEST TIP of ALL)
qq # record to q
your commands
q
@q to execute
@@ to Repeat
# editing a register/recording
"qp
you can now see contents of register q, edit as required
"qdd
# deletes the line back into q
Neat, expecially the part about editing the register contents.
Also :set ff=(unix|dos|mac) and then write the file to sort all your line ending woes.
3:04, Wednesday November 26th, 2003 • feeling enthusiastic • no comments
Turns on ftplugins! Took me ages to work out why they just weren't getting read. That's much better than setting up loads of autocommands. Just have one which sources a file once per buffer, rather than on every BufRead.
I also set up some Mac-like motion key commands, like Apple-right and such, so they behave as they do in standard OS X text controls. This will make it a lot easier for me to make the transition.
2:02, Wednesday November 26th, 2003 • feeling relaxed • no comments
au BufRead * set keywordprg=/Users/ben/Documents/bin/google.php
au BufRead *.java set keywordprg=/Users/ben/Documents/bin/google.php\ java\ site:sun.com
Autocommands are a powerful tool in Vim. By assigning autocommands to the BufRead action, I can specify commands to run whenever I move to a buffer. The next argument is a pattern to match on the file name. So here I'm saying, when you transfer to a buffer, set the keyword program to my Googling script. Then if the file is a java file, set the keywordprg to the Google script with some extra arguments which make the search more likely to return Javadoc for the thing I'm Googling.
Result: a custom editing mode for Java which knows more about the document that the standard environment. As I edit more and more files I'll be adding a lot of autocommands for each filetype using much of Vim's functionality, like macros for tags for an HTML mode. Because the menus in Vim are editable from scripts, I can add custom menus for each filetype as well.
It sounds like I should actually be doing this stuff with ftplugins as of version 6 though...