From 53c53b24440d14d7886484ad662549fc78550c40 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 5 Jun 2017 13:16:04 +0200 Subject: [PATCH] Make startify#fortune#boxe() handle funcref References #285. --- autoload/startify/fortune.vim | 3 ++- doc/startify.txt | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/autoload/startify/fortune.vim b/autoload/startify/fortune.vim index 3fb9a64..f312861 100644 --- a/autoload/startify/fortune.vim +++ b/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 diff --git a/doc/startify.txt b/doc/startify.txt index f32bc38..e9b4383 100644 --- a/doc/startify.txt +++ b/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')} \ ] < ------------------------------------------------------------------------------