Adapted from text mate bundle by GreyWyvern