Browse Source

Make startify#fortune#boxe() handle funcref

References #285.
Marco Hinz 8 năm trước cách đây
mục cha
commit
53c53b2444
2 tập tin đã thay đổi với 9 bổ sung4 xóa
  1. 2 1
      autoload/startify/fortune.vim
  2. 7 3
      doc/startify.txt

+ 2 - 1
autoload/startify/fortune.vim

@@ -159,7 +159,8 @@ endfunction
 " Function: #boxed {{{1
 function! startify#fortune#boxed(...) abort
   let wrapped_quote = []
-  let quote = a:0 && type(a:1) == type([]) ? a:1 : startify#fortune#quote()
+  let Quote = a:0 && type(a:1) == type([]) ? a:1 : startify#fortune#quote()
+  let quote = type(Quote) == type(function('tr')) ? Quote() : Quote
   for line in quote
     let wrapped_quote += split(line, '\%50c.\{-}\zs\s', 1)
   endfor

+ 7 - 3
doc/startify.txt

@@ -589,11 +589,15 @@ Also have a look at |startify-faq-08|.
 If you don't set |g:startify_custom_header|, the internal cowsay implementation
 with shipped random quotes will be used.
 
-If you want to use your own quotes, add a list of lists, like this:
+To use your own quotes, set this option to a list of quotes. Each quote is
+either another list or a |Funcref| (see |expr-lambda|) that returns a list.
+
+Each element of the inner lists is put on an own line in the custom header.
 >
     let g:startify_custom_header_quotes = [
-        \ ['line 1', '', 'line 3'],
-        \ ['quote #2']
+        \ ['quote #1'],
+        \ ['quote #2', 'using', 'three lines'],
+        \ {-> systemlist('echo quote #3')}
         \ ]
 <
 ------------------------------------------------------------------------------