def format_timedelta(seconds):
    """
    Format the time delta as human readable format such as '1h20m5s' or '5s' if it is short.
    """
    # We used to use the datetime.timedelta class, but its result such as
    #   Blade(info): cost time 00:05:30s
    # cause vim to create a new file named "Blade(info): cost time 00"
    # in vim QuickFix mode. So we use the new format now.
    mins = seconds // 60
    seconds %= 60
    hours = mins // 60
    mins %= 60
    if hours == 0 and mins == 0:
        return '%ss' % seconds
    if hours == 0:
        return '%sm%ss' % (mins, seconds)
    return '%sh%sm%ss' % (hours, mins, seconds)