Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 8E98F429E25 for ; Mon, 11 Jul 2011 11:37:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wr645mWYQ+FN for ; Mon, 11 Jul 2011 11:37:14 -0700 (PDT) Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C29A6431FB6 for ; Mon, 11 Jul 2011 11:37:14 -0700 (PDT) Received: by vxa40 with SMTP id 40so3193036vxa.26 for ; Mon, 11 Jul 2011 11:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=+LceFDsmYnCdnW8u9URrJoRqjPxehWryVa3t4NzEZfk=; b=vGN5GnKgUWHrTh97HOim2TsvSf+YVPHEk+/gcTbK2EKFqbur/t3UWj8U8YHYieESRs Q9FQo0BgbvRGIalvOVPsGGsMKz8Q+OrMFnmyq/lsD8vLVsZzNgcPj27qyXt4vWuViXTd +6o6hsCb/H/ZHvHib633eRhqvIInE8ThacJaw= Received: by 10.52.177.1 with SMTP id cm1mr5586175vdc.295.1310409434096; Mon, 11 Jul 2011 11:37:14 -0700 (PDT) Received: from localhost.localdomain (c-98-216-100-90.hsd1.ma.comcast.net [98.216.100.90]) by mx.google.com with ESMTPS id d3sm4620791vdg.24.2011.07.11.11.37.13 (version=SSLv3 cipher=OTHER); Mon, 11 Jul 2011 11:37:13 -0700 (PDT) Sender: Jason Woofenden From: Jason Woofenden To: notmuch@notmuchmail.org Subject: [PATCH] vim: add setting to shorten/fix sender names Date: Mon, 11 Jul 2011 14:37:01 -0400 Message-Id: <1310409421-4446-2-git-send-email-jason@jasonwoof.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1310409421-4446-1-git-send-email-jason@jasonwoof.com> References: <1310409421-4446-1-git-send-email-jason@jasonwoof.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2011 18:37:15 -0000 Add a new setting: g:notmuch_nicknames (dictionary) When reformatting the list of senders in the search view, replace any names matching keys in g:notmuch_nicknames with the corresponding values. --- vim/plugin/notmuch.vim | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 12a0f88..5debaf6 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -103,6 +103,10 @@ let s:notmuch_compose_headers_defaults = [ \ 'Subject' \ ] +" To shorten/change the sender names in the search views: +" let g:notmuch_nicknames = {'John Smith': 'me', 'Jane Smith': 'Jane'} + + " --- keyboard mapping definitions {{{1 " --- --- bindings for folders mode {{{2 @@ -267,7 +271,20 @@ function! s:NM_cmd_search_fmtline(line) let p = split(at, '[@.]') let flist[p[0]] = 1 endfor - let from = join(keys(flist), ", ") + if exists('g:notmuch_nicknames') + let from_fixed = [] + for at in keys(flist) + if has_key(g:notmuch_nicknames, at) + call add(from_fixed, g:notmuch_nicknames[at]) + else + call add(from_fixed, at) + endif + endfor + let from = join(from_fixed, ', ') + else + let from = join(keys(flist), ', ') + endif + return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6]) endfunction -- 1.7.5.4