From 994a85ac2273d89714c4ead4fb3014774faaf14a Mon Sep 17 00:00:00 2001
From: Marco Hinz <mh.codebro@gmail.com>
Date: Thu, 17 Mar 2016 11:05:36 +0100
Subject: [PATCH] Refactoring: fortune.vim

---
 autoload/startify.vim         |  2 +-
 autoload/startify/fortune.vim | 22 +++++++++++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/autoload/startify.vim b/autoload/startify.vim
index 5d6aa57..260a5e6 100644
--- a/autoload/startify.vim
+++ b/autoload/startify.vim
@@ -70,7 +70,7 @@ function! startify#insane_in_the_membrane() abort
   " Must be global so that it can be read by syntax/startify.vim.
   let g:startify_header = exists('g:startify_custom_header')
         \ ? copy(g:startify_custom_header)
-        \ : startify#fortune#get_random_quote()
+        \ : startify#fortune#cowsay()
   let g:startify_header += ['']  " add blank line
   call append('$', g:startify_header)
 
diff --git a/autoload/startify/fortune.vim b/autoload/startify/fortune.vim
index f9443c4..d3e3f1c 100644
--- a/autoload/startify/fortune.vim
+++ b/autoload/startify/fortune.vim
@@ -11,6 +11,7 @@ let s:cow = [
 let s:quotes = exists('g:startify_custom_header_quotes')
       \ ? g:startify_custom_header_quotes
       \ : [
+      \ ["If you don't fail at least 90% of the time, you're not aiming high enough.", '', '- Alan Kay'],
       \ ['I think a lot of new programmers like to use advanced data structures and advanced language features as a way of demonstrating their ability. I call it the lion-tamer syndrome. Such demonstrations are impressive, but unless they actually translate into real wins for the project, avoid them.', '', '- Glyn Williams'],
       \ ['I would rather die of passion than of boredom.', '', '- Vincent Van Gogh'],
       \ ['If a system is to serve the creative spirit, it must be entirely comprehensible to a single individual.'],
@@ -128,14 +129,25 @@ function! s:draw_box(lines) abort
   return lines
 endfunction
 
-" Function: #get_random_quote {{{1
-function! startify#fortune#get_random_quote() abort
-  let quote = s:quotes[s:get_random_offset(len(s:quotes))]
+" Function: #quote {{{1
+function! startify#fortune#quote() abort
+  return s:quotes[s:get_random_offset(len(s:quotes))]
+endfunction
+
+" Function: #boxed {{{1
+function! startify#fortune#boxed() abort
   let wrapped_quote = []
+  let quote = startify#fortune#quote()
   for line in quote
     let wrapped_quote += split(line, '\%50c.\{-}\zs\s', 1)
   endfor
   let wrapped_quote = s:draw_box(wrapped_quote)
-  let wrapped_quote += s:cow
-  return map(wrapped_quote, '"   ". v:val')
+  return wrapped_quote
+endfunction
+
+" Function: #cowsay {{{1
+function! startify#fortune#cowsay() abort
+  let boxed_quote = startify#fortune#boxed()
+  let boxed_quote += s:cow
+  return map(boxed_quote, '"   ". v:val')
 endfunction