tadhg.com
tadhg.com
 

Punctuation, Typography, and Vim

22:28 Mon 31 Jan 2011. Updated: 10:39 26 Mar 2011
[, , , ]

I’ve cared about typographically correct punctuation (as well and as distinct from grammatically correct punctuation) for as longer than I’ve had a computer. The difference between typical home computer output (and display) and typography as seen in books was always glaringly evident, and I wanted to narrow that gap as much as possible. This post is a discussion of some of the issues, how I’ve handled them in the past, and my current approaches.

The characters I’m referring to are primarily these:

apostrophe or right single quotation mark: ’
left and right double quotation marks: “”
em dash: —
en dash: –
ellipsis: …

There are also some accented characters, such as é and ü, that come up relatively frequently and that I wanted correctly represented as well.

By the time I had a computer of my own, running Windows 3.1, on-screen display of non-ASCII characters wasn’t problematic. The 1252 code page supported all the characters I was concerned with.

That only left input: none of these characters are present on a standard keyboard. At first I was happy to use “smart quotes” features, primarily in Microsoft Word, but this quickly became irritating, partly because it occasionally didn’t work correctly. In addition, I had to enter em and en dashes manually anyway, so I became familiar with the Alt+Numpad method of entering non-standard characters, and ended up using that for all the punctuation marks instead of relying on the “smart quotes” functionality.

That was awkward, but worked fine for years, although platform and software changes, as well as occasional laziness, meant that I would resort to straight quotation marks from time to time. I also went back and forth on using “smart quotes” functionality, from Word to OpenOffice to AbiWord (and switching between the latter two, for quite a while). Switching platforms and programs, sometimes day to day, made me more lazy about the keyboard combinations required to input the characters I wanted, so a number of my documents reflect that—including quite a few of posts from when I started blogging regularly. It took me a while to get used to the Mac shortcuts, which I now consider more user-friendly but less versatile than the Windows approach—rather than entering a number combination, on a Mac you hold Option and a key somewhat similar to the intended character, such as Shift-Option-hyphen for em dash.

Incidentally, I’ve been most lazy about the ellipsis, for some reason tolerating its replacement by three full stops far more than I do the other marks’ poor relations; I’ll have to make an effort to rectify that.

That’s worked pretty well for quite some time, but as I’ve become more adept with Vim, I’ve noticed more and more the delay induced by the chording required, so I’ve come up with some other approaches.

The longest-standing of these is to never use single quotation marks for anything unless absolutely necessary, instead using the double quotation marks. This means that I generally only need the apostrophe, and I can use the straight single quote for that and then globally replace it. This is how I write my blog posts and morning pages, and the “finishing step” for both simply replaces all the single straight quotation marks with right quotation marks. No need for any move away from the home row.

For the double quotation marks, I recently switched from using the Option+[ and Option+Shift+[ chords and instead to using a snipMate.vim snippet; now when I enter q followed by Tab the quotation marks are entered for me, the cursor is in between them, and hitting Tab again brings the cursor to after the closing quotation mark. That’s been working quite well.

I’ve just started experimenting with remapping -- and -<Space> to em dash and en dash in insert mode. That works well, especially since I have the habit of using two hyphens for em dash anyway when I’m in ASCII environments. I haven’t yet found good answers of that kind for the various accented characters, which admittedly I don’t enter quite often enough to make that imperative. CrossFit, the American use of ℞ to mean “prescribed” in a medicinal sense, and the CrossFit slang of using that as a way to indicate whether or not a workout is done exactly as specified (usually with respect to the weights involved), means that I also have a snippet that turns rx<Tab> into ℞.

I still haven’t figured out a good approach for the ellipsis, though. A mapping using the period is problematic because then there’d be a slight delay every single time I hit period, and that just seems too annoying. I’ll try inoremap <buffer> ;; as two semicolons more or less equal an ellipsis, and are easy to type.

4 Responses to “Punctuation, Typography, and Vim”

  1. Seth Milliken Says:

    Mac OS X has a Unicode Hex Input input source that works a lot like the Windows method. It’s not enabled by default, but it’s there–buried in the Language & Text System Preference pane under Input Sources.

    The ;; imap looks like it is probably going to be faster and better, but FYI <A-;> inserts an ellipses on Mac OS X.

  2. tim Says:

    Well, on Linux you can use compose keys like this:
    setxkbmap -model pc104 -layout us -option caps:escape,compose:ralt,eurosign:e

    See /usr/share/X11/locale/en_US.UTF-8/Compose for all available keys.

    Press [Compose] + [.] + [.] (i.e., compose key and then two separate points) which yields …

    You can also use your beloved quotes with compose keys: “ ” ‚ ‘ ’ « » (and many others)

    And accents work as well: ä é ö ç

    The advantage is that it’s system-wide. I can use the accents in Chromium, in LibreOffice and also in Vim.

    The only issue I’m facing when using the typographic quotes is that spell-checking wouldn’t work properly when I’m using them in French texts:

    “l’organisation” underlines the l’ whereas it doesn’t complain for the ‘traditional’ quotes: “l’organisation”. How did you solve this?

  3. Tadhg Says:

    Seth: Yes, I was using Option-; before, but ;; is definitely nice.

    Tim: OS X has similar functionality using the Option key, but one of the reasons I made those Vim mappings was that I’m trying to avoid chording, since it’s uncomfortable and seems to be bad for my wrists/hands—also, it takes my fingers off the home row.

    I have the same problem with the typographically-correct quotation marks and spellcheck, unfortunately. At least in Vim’s English dictionaries, it treats ’ as a separator and so e.g. “don’t” results in spellcheck claiming the “t” is a misspelt word. However, this doesn’t bother me that much, because I tend to use the straight single quote while writing—exclusively as an apostrophe, and never as a closing quotation mark—and then run a script that replaces “’” with “’” when I’m finished writing.

  4. lx Says:

    It sounds like for your purposes, you’d get good use out of UniCycle:

    http://www.vim.org/scripts/script.php?script_id=1384

    Still leaves the spellcheck problem, but fixes dashes, ellipsis, quotes, etc.

Leave a Reply