Posts for the month of November 2009

Better line wrapping in Vim

So I wanted Vim to visually wrap long lines, but take the indentation of the line into account when it does so. Apparently, Vim can't do that but back in 2007 Vaclav Smilauer posted a patch for Vim to add that feature. I updated the patch to apply to the current version of Vim in Fedora 11, 7.2.148-1.fc11. To get this behaviour, rebuild vim with this patch, then set breakindent. It isn't bug-free; it appears to interact badly with set linebreak. But you can combine it with set showbreak=.. or set showbreak=\ \ to provide a little bit of additional indent to the wrapped portion of the lines.

Modifying a Belt Pouch for a ADP1/G1

I have been using a little black pouch with a hook and loop fastener for... a while now. But it began to develop a distressing tendency to open at unexpected and inopportune times, such as when I'm standing at the top of a set of stairs, and let my precious Android Dev Phone 1 tumble to the ground, and down the stairs. Time to find something that would work better. I went to the T-Mobile store, and bought a leather belt pouch. But it drove me crazy -- I had to push the phone up from below, then try to grasp it from the top with out dropping it, and the top flap had a metal button on the inside that would scrape across the screen when I pulled the phone out.

At the mall recently, I saw a leather pouch that would almost work for what I wanted: a Mybat leather belt pouch that looks like this:

("Before" image generously provided by my friends at Culture Red.)

This pouch had a smooth leather interior on the underside of the flap, and two magnets; one near each corner of the flap. It also had the exact same problem of having to push the phone up from below, and attempt to grasp it from the top without dropping it.

However, the two-magnet design allowed for a slight modification to the belt pouch:

I used a box cutter to slice down the center of the face of the pouch, then I peeled back the leather, padding, and backing to expose about 1/4" of the internal cardboard. I cut about 1/4" of the cardboard off both sides, then folded the leather back to where it had been originally. Then I wrapped the leather over the new edge of the cardboard and stuck the backing over the back edge of the leather. Then I (amateurishly) hand-stitched through it all to hold it in place and trimmed the backing to size. The stitching was rather fiddly, but I managed it.

The resulting gap in the front allows me to lift the flap with my thumb, grasp the phone with a finger and that thumb, and remove the phone from the pouch in an easy and quick motion. This works so much better than the original. The phone does not feel quite as secure in the pouch as it originally did, but in a bit of ad-hoc testing (shaking it upside down, flap down, and whatnot), it held the phone just fine.

If I were to do this all over again, I would:

  • measure and square the location of the center to cut
  • measure the amount of internal cardboard to cut
  • do better stitching