[PATCH] vim: add setting to shorten/fix sender names
[notmuch-archives.git] / 5d / a00f805efaf904ca39ee3e2ca6bcc6f683317b
1 Return-Path: <jasonwoof@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 8E98F429E25\r
6         for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 11:37:15 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.699\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
13         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id Wr645mWYQ+FN for <notmuch@notmuchmail.org>;\r
17         Mon, 11 Jul 2011 11:37:14 -0700 (PDT)\r
18 Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com\r
19         [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id C29A6431FB6\r
22         for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 11:37:14 -0700 (PDT)\r
23 Received: by vxa40 with SMTP id 40so3193036vxa.26\r
24         for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 11:37:14 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to\r
27         :references; bh=+LceFDsmYnCdnW8u9URrJoRqjPxehWryVa3t4NzEZfk=;\r
28         b=vGN5GnKgUWHrTh97HOim2TsvSf+YVPHEk+/gcTbK2EKFqbur/t3UWj8U8YHYieESRs\r
29         Q9FQo0BgbvRGIalvOVPsGGsMKz8Q+OrMFnmyq/lsD8vLVsZzNgcPj27qyXt4vWuViXTd\r
30         +6o6hsCb/H/ZHvHib633eRhqvIInE8ThacJaw=\r
31 Received: by 10.52.177.1 with SMTP id cm1mr5586175vdc.295.1310409434096;\r
32         Mon, 11 Jul 2011 11:37:14 -0700 (PDT)\r
33 Received: from localhost.localdomain (c-98-216-100-90.hsd1.ma.comcast.net\r
34         [98.216.100.90])\r
35         by mx.google.com with ESMTPS id d3sm4620791vdg.24.2011.07.11.11.37.13\r
36         (version=SSLv3 cipher=OTHER); Mon, 11 Jul 2011 11:37:13 -0700 (PDT)\r
37 Sender: Jason Woofenden <jasonwoof@gmail.com>\r
38 From: Jason Woofenden <jason@jasonwoof.com>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH] vim: add setting to shorten/fix sender names\r
41 Date: Mon, 11 Jul 2011 14:37:01 -0400\r
42 Message-Id: <1310409421-4446-2-git-send-email-jason@jasonwoof.com>\r
43 X-Mailer: git-send-email 1.7.5.4\r
44 In-Reply-To: <1310409421-4446-1-git-send-email-jason@jasonwoof.com>\r
45 References: <1310409421-4446-1-git-send-email-jason@jasonwoof.com>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Mon, 11 Jul 2011 18:37:15 -0000\r
59 \r
60 Add a new setting: g:notmuch_nicknames (dictionary)\r
61 \r
62 When reformatting the list of senders in the search view, replace any names\r
63 matching keys in g:notmuch_nicknames with the corresponding values.\r
64 ---\r
65  vim/plugin/notmuch.vim |   19 ++++++++++++++++++-\r
66  1 files changed, 18 insertions(+), 1 deletions(-)\r
67 \r
68 diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim\r
69 index 12a0f88..5debaf6 100644\r
70 --- a/vim/plugin/notmuch.vim\r
71 +++ b/vim/plugin/notmuch.vim\r
72 @@ -103,6 +103,10 @@ let s:notmuch_compose_headers_defaults = [\r
73          \ 'Subject'\r
74          \ ]\r
75  \r
76 +" To shorten/change the sender names in the search views:\r
77 +" let g:notmuch_nicknames = {'John Smith': 'me', 'Jane Smith': 'Jane'}\r
78 +\r
79 +\r
80  " --- keyboard mapping definitions {{{1\r
81  \r
82  " --- --- bindings for folders mode {{{2\r
83 @@ -267,7 +271,20 @@ function! s:NM_cmd_search_fmtline(line)\r
84                  let p = split(at, '[@.]')\r
85                  let flist[p[0]] = 1\r
86          endfor\r
87 -        let from = join(keys(flist), ", ")\r
88 +        if exists('g:notmuch_nicknames')\r
89 +                let from_fixed = []\r
90 +                for at in keys(flist)\r
91 +                        if has_key(g:notmuch_nicknames, at)\r
92 +                                call add(from_fixed, g:notmuch_nicknames[at])\r
93 +                        else\r
94 +                                call add(from_fixed, at)\r
95 +                        endif\r
96 +                endfor\r
97 +                let from = join(from_fixed, ', ')\r
98 +        else\r
99 +                let from = join(keys(flist), ', ')\r
100 +        endif\r
101 +\r
102          return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6])\r
103  endfunction\r
104  \r
105 -- \r
106 1.7.5.4\r
107 \r