From: Nicolas Boisselier Date: Mon, 12 Dec 2022 19:52:48 +0000 (+0100) Subject: Move function MeNow X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=6b8ec7044db79c788898d4c12e038b8eb156a379;p=nb.git Move function MeNow --- diff --git a/etc/vim/source/comment.vim b/etc/vim/source/comment.vim index 8ad4a7eb..f95505fa 100644 --- a/etc/vim/source/comment.vim +++ b/etc/vim/source/comment.vim @@ -4,6 +4,11 @@ " NB 12.12.22: Functions to comment texts " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +func! CommentMeNow() + let user_initials = system('printf "%s" ${USER_INITIALS:-`whoami`}') + return $user_initials . ' ' . strftime('%d.%m.%y') +endfunc + func! CommentSubSpecialChar(text) " NB 12.12.22: Substitute specials char like \n in an array let i = 0 @@ -29,7 +34,7 @@ func! CommentNewLine() call CommentSubSpecialChar(comment) " Beginning of line - let new_line = comment[0].' '.MeNow().': foo ' + let new_line = comment[0].' '.CommentMeNow().': foo ' " End of line if ( len(comment)>1 ) @@ -71,7 +76,7 @@ func! CommentToggle() " NB 11.12.22 let v = '' " NB 11.12.22 let v = '' " Beginning of line - let new_line = substitute(curr_line,'^\([\t ]*\)','\1'.comment[0].' '.MeNow().' ','') + let new_line = substitute(curr_line,'^\([\t ]*\)','\1'.comment[0].' '.CommentMeNow().' ','') " End of line if ( len(comment)>1 ) let new_line = substitute(new_line,'\s*$',' '.comment[1],'') diff --git a/etc/vim/source/functions.vim b/etc/vim/source/functions.vim index 459c25bd..dfd865d8 100644 --- a/etc/vim/source/functions.vim +++ b/etc/vim/source/functions.vim @@ -142,10 +142,6 @@ func! FileCheck() endfunc -func! MeNow() - return $USER_INITIALS . ' ' . strftime('%d.%m.%y') -endfunc - function Err(txt) echo 'ERROR: '.a:txt return