]> git.nbdom.net Git - nb.git/commitdiff
Move function MeNow
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 12 Dec 2022 19:52:48 +0000 (20:52 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 12 Dec 2022 19:52:48 +0000 (20:52 +0100)
etc/vim/source/comment.vim
etc/vim/source/functions.vim

index 8ad4a7ebc35a55dae9e5edf06e5bbd57be8031c7..f95505fa5c1c9839b781cd7c389c23005562c6c8 100644 (file)
@@ -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],'')
index 459c25bd5b2c6afcb3b36e2fc11df99958800fbb..dfd865d8030d671f47425b2945691069c85ad79c 100644 (file)
@@ -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