Jun. 1st, 2011

jack: (Default)
If you look at something like morse code, you'll see that the common letters tend to have short representations, and the rare letters longer ones. That mapping is far from perfect for many reasons, but it makes sense for conveying a message quickly. Even if the varying lengths mean that it might take more bits to send "abcdefghijklmnopqrstuvwxyz" than if you always used the most obvious binary representation. (This is not exact for morse code, for starters because you're assumed to get spaces between the letters for "free". But will be true for alphabets encoded to a bitstream on a computer, and is systematised in something like http://en.wikipedia.org/wiki/Huffman_coding, used in many compression streams.)

I wanted to say something similar about encoding special characters in strings, or mixing HTML and a programming language in the same source file (do you have a way of including HTML in your programming language, or vice versa?) but it didn't quite come together.

However, I was thinking about it in the context of vi. Most text editors have -- almost all the time -- pressing 'a' meaning "put an 'a' into the document". This means that anything else you want to do -- copying, pasting, editing, etc, etc -- will almost certainly involve holding down ctrl. vi is the opposite -- you switch between an insert mode, where letter keys insert letters, and normal mode, where they do editing features. This feels unspeakably ridiculous the first time you try it: entering text is the simplest and first feature you use in a text editor, and if it requires a special mode, you will probably quit the editor and never use it again.

However, it eminently makes sense: most people alternate between typing for a while, and then making several edits. I already have a reflex to hit a key after I finish typing -- I hit the shortcut for 'save'. So it is a lot easier and efficient if you're used to it.

This was put into my head by reading a blog post somewhere by someone who reckoned that vi's default keyboard interface was better than emacs, but emacs ability to do everything under ths sun and then some is better than emacs, and switched from vim to emacs-with-vi-key-bindings, thus pissing off everyone on both sides of the holy war :)

Active Recent Entries