[PATCH] vim: add setting to shorten/fix sender names

Jason Woofenden jason at jasonwoof.com
Mon Jul 11 11:37:01 PDT 2011


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



More information about the notmuch mailing list