commit:     632d0a72c83cd0ccf7f40cb64470dc84f51bdce2
Author:     Freed-Wu <Wuzy01 <AT> qq <DOT> com>
AuthorDate: Thu Jun  4 05:28:32 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jun  4 06:02:21 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-syntax.git/commit/?id=632d0a72

use git config to get email and name of user

Closes: https://github.com/gentoo/gentoo-syntax/pull/29
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 plugin/gentoo-common.vim | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/plugin/gentoo-common.vim b/plugin/gentoo-common.vim
index 65a8691..a0fe9cc 100644
--- a/plugin/gentoo-common.vim
+++ b/plugin/gentoo-common.vim
@@ -13,10 +13,9 @@ let g:loaded_gentoo_common=1
 fun! GentooGetUser()
     let l:result = expand("\$ECHANGELOG_USER")
     if l:result ==# "\$ECHANGELOG_USER"
-        let l:result = expand("\$USER")
-    endif
-    if l:result ==# "\$USER"
-        let l:result = ""
+        let l:email = system('git config --global user.email')
+        let l:name = system('git config --global user.name')
+        let l:result = l:name . ' <' . l:email . '>'
     endif
     return l:result
 endfun
@@ -71,4 +70,4 @@ fun! GentooGetPythonTargets()
     endif
 endfun
 
-" vim: set et foldmethod=marker : "
+" vim: set et foldmethod=marker sw=4 ts=4 : "

Reply via email to