[PATCH 2/3] vim: fix get_user_email()

Felipe Contreras felipe.contreras at gmail.com
Thu Dec 9 14:16:24 PST 2010


From: Felipe Contreras <felipe.contreras at ngmail.com>

Signed-off-by: Felipe Contreras <felipe.contreras at ngmail.com>
---
 vim/plugin/notmuch.vim |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 6898d56..8815712 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -1027,11 +1027,9 @@ endfunction
 " --- --- compose screen helper functions {{{2
 
 function! s:NM_compose_get_user_email()
-        let name = substitute(system('id -u -n'), '\v(^\s*|\s*$|\n)', '', 'g')
-        let fqdn = substitute(system('hostname -f'), '\v(^\s*|\s*$|\n)', '', 'g')
-
-        " TODO: do this properly
-        return name . '@' . fqdn
+        let rname = system("getent passwd $USER | cut -d ':' -f 5")
+        let rname = substitute(rname, '\n*$', '', '')
+        return printf("%s <%s>", rname, $EMAIL)
 endfunction
 
 function! s:NM_compose_find_line_match(start, pattern, failure)
-- 
1.7.3.2



More information about the notmuch mailing list