Browse Source

Doc: slightly improve the centered header example

Marco Hinz 6 năm trước cách đây
mục cha
commit
a27df8325c
1 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 7 5
      doc/startify.txt

+ 7 - 5
doc/startify.txt

@@ -985,13 +985,15 @@ How do I center my header/footer?~
 
 Try something along these lines:
 >
-    function! s:filter_header(lines) abort
-        let longest_line   = max(map(copy(a:lines), 'strwidth(v:val)'))
-        let centered_lines = map(copy(a:lines),
+    function! s:center(lines) abort
+      let longest_line   = max(map(copy(a:lines), 'strwidth(v:val)'))
+      let centered_lines = map(copy(a:lines),
             \ 'repeat(" ", (&columns / 2) - (longest_line / 2)) . v:val')
-        return centered_lines
+      return centered_lines
     endfunction
-    let g:startify_custom_header = s:filter_header(startify#fortune#cowsay())
+
+    let g:startify_custom_header = s:center(startify#fortune#cowsay())
+    let g:startify_custom_footer = s:center(['foo', 'bar', 'baz'])
 <
 ------------------------------------------------------------------------------
                                                                *startify-faq-09*