Enabling mouse support in Vim

Enabling mouse support in Vim
Hopefully you are using newer equipment than this...

Hopefully you are using newer equipment than this…

If you’ve ever logged into a server using an ssh client (like PuTTY), then you’ve probably used Vim. This infinitely customizable text editor typically runs within a keyboard-only shell, and thus only lets you use the keyboard (unless you are running something like gVim). You use the arrow keys to move the cursor around and a slew of keyboard shortcuts to insert, move, delete, or otherwise manipulate the text.

If you are a Linux user I just told you a bunch of stuff you already know. But did you know that Vim has mouse support? You just have to turn it on. Open Vim and enter this command:

:set mouse=a

You’ll now have mouse support until you exit Vim and load it up again. To make the change permanent, edit your .vimrc file (typically at ~/.vimrc) and add set mouse=a to the end of the file.

So how do you use the mouse in Vim? What benefits will you get? There are a few things you need to know:

  1. Copying text: You may be in the habit of highlighting text and having it put on your system’s clipboard. This won’t work anymore. When you click and drag to highlight text, you’ll be put into Visual mode, an amazingly powerful part of Vim that many people never use. I highly recommend learning more about Visual mode, but if you want the original behavior you can hold shift while selecting text.
  2. Placing the cursor: Instead of having to use the arrow keys to move your cursor, you can now just click wherever you want it to be. Huge time saver.
  3. Scrolling: Yup, you can scroll with the mouse wheel now. No more hitting page down a hundred times in a giant file. Just scroll that wheel to get to wherever you want in your file.

After a few days of reaping the many benefits of Douglas Engelbart’s wonderful little invention, you may be asking yourself: Why isn’t mouse support turned on by default?! I’m not really sure. I did a bit of searching but couldn’t find a definitive answer. If you figure it out, please let me know!

Read More

git in color

git in color

By default, git doesn’t use color. It is gray gray gray. Bleh. But with a single line in your shell you can enable color for git:

git config --global --add color.ui true

Bam! Color for your git diff, merge, add, commit… Everything. It is amazing how much a little color can help.

Without Color

Without Color

With Color

With Color

Read More

Postmark is awesome for transactional emails

Postmark is awesome for transactional emails
Update 2/20/14: I’ve switched to SendGrid. I’ve been using them for a few weeks and am completely satisfied!

Update 10/31/13: Postmark has terminated my account because they aren’t comfortable with the Fake Name Generator. I’m disappointed that they would make this decision, and I can no longer recommend their services.

The Fake Name Generator lets people order (for free!) large lists of fake names, addresses, and other information. It can take a few minutes to generate the data files, so users are required to give me their email address so I can send them an email when their order is ready.

This has caused me a few problems:

  1. Order fulfillment emails sometimes go to spam. So people enter more orders, which takes up server processing time, and they still don’t get them because they never check their spam folder. Or they put in a support request, which means I’m having to spend time chasing the issue.
  2. People enter fake email addresses. This one drives me crazy. There isn’t any way to give them their order if they don’t give me a valid email address, yet people will put in a dozen orders using bogus email addresses that ultimately bounce back to my inbox.

To solve this, I’ve done a few things.

First, instead of sending email directly from my server, I’m using Postmark, a service that is specifically designed for transactional emails. Postmark is amazing. With just a few clicks I had a virtual mail server configured with DKIM, SPF, and SenderID. It uses an API instead of clunky SMTP to accept emails. This was easy to integrate using some free code I found online. Because it is only used for transactional emails, deliverability is extremely high.

It also comes with a few additional perks. It lets me see every email I send out, so if I do get a support request, I don’t have to ask anyone to forward me emails or links or wonder if the email was actually delivered.

Postmark helped me solve the bounce problem, too. It lets you use a hook URL to handle bounces. I set up a simple script that grabs the email address for any bounced email and blocks that email from ever ordering from my site again.

There are a lot of alternatives to Postmark out there and some are considerably cheaper, such as Amazon SES and SendGrid. I did a fair amount of research before picking a vendor. To be honest, Postmark just seems better. They are more reliable, they have more features that I’ll actually use, their pricing is pay-as-you-go (no monthly minimums), and their API is lightweight and easy to use.

Read More