Add various version of stdheader and patches
This commit is contained in:
165
vim/stdheader.vim-42lausanne.patch
Normal file
165
vim/stdheader.vim-42lausanne.patch
Normal file
@@ -0,0 +1,165 @@
|
||||
--- stdheader.vim 2021-06-10 22:51:40.000000000 +0200
|
||||
+++ stdheader.vim 2021-10-25 09:58:04.000000000 +0200
|
||||
@@ -3,10 +3,10 @@
|
||||
" ::: :::::::: "
|
||||
" stdheader.vim :+: :+: :+: "
|
||||
" +:+ +:+ +:+ "
|
||||
-" By: zaz <zaz@staff.42.fr> +#+ +:+ +#+ "
|
||||
+" By: <gbaconni@student.42lausanne.ch> +#+ +:+ +#+ "
|
||||
" +#+#+#+#+#+ +#+ "
|
||||
" Created: 2013/06/15 12:45:56 by zaz #+# #+# "
|
||||
-" Updated: 2021/02/01 12:32:13 by xitope ### ########.fr "
|
||||
+" Updated: 2021/10/25 09:58:04 by gbaconni ### lausanne.ch "
|
||||
" "
|
||||
" **************************************************************************** "
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
\" +#+ +:+ +#+ ",
|
||||
\"+#+#+#+#+#+ +#+ ",
|
||||
\" #+# #+# ",
|
||||
- \" ### ########.fr "
|
||||
+ \" ### lausanne.ch "
|
||||
\]
|
||||
|
||||
let s:styles = [
|
||||
@@ -60,91 +60,91 @@
|
||||
let s:marginlen = 5
|
||||
let s:contentlen = s:linelen - (3 * s:marginlen - 1) - strlen(s:asciiart[0])
|
||||
|
||||
-function s:trimlogin ()
|
||||
+function! s:trimlogin ()
|
||||
let l:trimlogin = strpart($USER, 0, 9)
|
||||
if strlen(l:trimlogin) == 0
|
||||
- let l:trimlogin = "marvin"
|
||||
+ let l:trimlogin = "rfederer"
|
||||
endif
|
||||
return l:trimlogin
|
||||
endfunction
|
||||
|
||||
-function s:trimemail ()
|
||||
+function! s:trimemail ()
|
||||
let l:trimemail = strpart($MAIL, 0, s:contentlen - 16)
|
||||
if strlen(l:trimemail) == 0
|
||||
- let l:trimemail = "marvin@42lausanne.ch"
|
||||
+ let l:trimemail = "rfederer@student.42lausanne.ch"
|
||||
endif
|
||||
return l:trimemail
|
||||
endfunction
|
||||
|
||||
-function s:midgap ()
|
||||
+function! s:midgap ()
|
||||
return repeat(' ', s:marginlen - 1)
|
||||
endfunction
|
||||
|
||||
-function s:lmargin ()
|
||||
+function! s:lmargin ()
|
||||
return repeat(' ', s:marginlen - strlen(s:start))
|
||||
endfunction
|
||||
|
||||
-function s:rmargin ()
|
||||
+function! s:rmargin ()
|
||||
return repeat(' ', s:marginlen - strlen(s:end))
|
||||
endfunction
|
||||
|
||||
-function s:empty_content ()
|
||||
+function! s:empty_content ()
|
||||
return repeat(' ', s:contentlen)
|
||||
endfunction
|
||||
|
||||
-function s:left ()
|
||||
+function! s:left ()
|
||||
return s:start . s:lmargin()
|
||||
endfunction
|
||||
|
||||
-function s:right ()
|
||||
+function! s:right ()
|
||||
return s:rmargin() . s:end
|
||||
endfunction
|
||||
|
||||
-function s:bigline ()
|
||||
+function! s:bigline ()
|
||||
return s:start . ' ' . repeat(s:fill, s:linelen - 2 - strlen(s:start) - strlen(s:end)) . ' ' . s:end
|
||||
endfunction
|
||||
|
||||
-function s:logo1 ()
|
||||
+function! s:logo1 ()
|
||||
return s:left() . s:empty_content() . s:midgap() . s:asciiart[0] . s:right()
|
||||
endfunction
|
||||
|
||||
-function s:fileline ()
|
||||
+function! s:fileline ()
|
||||
let l:trimfile = strpart(fnamemodify(bufname('%'), ':t'), 0, s:contentlen)
|
||||
return s:left() . l:trimfile . repeat(' ', s:contentlen - strlen(l:trimfile)) . s:midgap() . s:asciiart[1] . s:right()
|
||||
endfunction
|
||||
|
||||
-function s:logo2 ()
|
||||
+function! s:logo2 ()
|
||||
return s:left() . s:empty_content() . s:midgap() .s:asciiart[2] . s:right()
|
||||
endfunction
|
||||
|
||||
-function s:coderline ()
|
||||
+function! s:coderline ()
|
||||
let l:contentline = "By: ". s:trimlogin () . ' <' . s:trimemail () . '>'
|
||||
return s:left() . l:contentline . repeat(' ', s:contentlen - strlen(l:contentline)) . s:midgap() . s:asciiart[3] . s:right()
|
||||
endfunction
|
||||
|
||||
-function s:logo3 ()
|
||||
+function! s:logo3 ()
|
||||
return s:left() . s:empty_content() . s:midgap() .s:asciiart[4] . s:right()
|
||||
endfunction
|
||||
|
||||
-function s:dateline (prefix, logo)
|
||||
+function! s:dateline (prefix, logo)
|
||||
let l:date = strftime("%Y/%m/%d %H:%M:%S")
|
||||
let l:contentline = a:prefix . ": " . l:date . " by " . s:trimlogin ()
|
||||
return s:left() . l:contentline . repeat(' ', s:contentlen - strlen(l:contentline)) . s:midgap() . s:asciiart[a:logo] . s:right()
|
||||
endfunction
|
||||
|
||||
-function s:createline ()
|
||||
+function! s:createline ()
|
||||
return s:dateline("Created", 5)
|
||||
endfunction
|
||||
|
||||
-function s:updateline ()
|
||||
+function! s:updateline ()
|
||||
return s:dateline("Updated", 6)
|
||||
endfunction
|
||||
|
||||
-function s:emptyline ()
|
||||
+function! s:emptyline ()
|
||||
return s:start . repeat(' ', s:linelen - strlen(s:start) - strlen(s:end)) . s:end
|
||||
endfunction
|
||||
|
||||
-function s:filetype ()
|
||||
+function! s:filetype ()
|
||||
let l:file = fnamemodify(bufname("%"), ':t')
|
||||
|
||||
let s:start = '#'
|
||||
@@ -162,7 +162,7 @@
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
-function s:insert ()
|
||||
+function! s:insert ()
|
||||
call s:filetype ()
|
||||
|
||||
call append(0, "")
|
||||
@@ -179,7 +179,7 @@
|
||||
call append (0, s:bigline())
|
||||
endfunction
|
||||
|
||||
-function s:update ()
|
||||
+function! s:update ()
|
||||
call s:filetype ()
|
||||
|
||||
let l:pattern = s:start . repeat(' ', 5 - strlen(s:start)) . "Updated: [0-9]"
|
||||
@@ -190,6 +190,6 @@
|
||||
endif
|
||||
endfunction
|
||||
|
||||
-command Stdheader call s:insert ()
|
||||
+command! Stdheader call s:insert ()
|
||||
nmap <F1> :Stdheader<CR>
|
||||
-autocmd BufWritePre * call s:update ()
|
||||
\ No newline at end of file
|
||||
+autocmd BufWritePre * call s:update ()
|
||||
Reference in New Issue
Block a user