Show random quotes if g:startify_custom_header isn't set
This commit is contained in:
parent
8434c33f7a
commit
fa733c3e20
|
@ -67,9 +67,12 @@ function! startify#insane_in_the_membrane() abort
|
||||||
setlocal norelativenumber
|
setlocal norelativenumber
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists('g:startify_custom_header')
|
" Must be global so that it can be read by syntax/startify.vim.
|
||||||
call append('$', g:startify_custom_header)
|
let g:startify_header = exists('g:startify_custom_header')
|
||||||
endif
|
\ ? copy(g:startify_custom_header)
|
||||||
|
\ : startify#fortune#get_random_quote()
|
||||||
|
let g:startify_header += [''] " add blank line
|
||||||
|
call append('$', g:startify_header)
|
||||||
|
|
||||||
let s:tick = 0
|
let s:tick = 0
|
||||||
let s:entries = {}
|
let s:entries = {}
|
||||||
|
@ -124,10 +127,7 @@ function! startify#insane_in_the_membrane() abort
|
||||||
|
|
||||||
" compute first line offset
|
" compute first line offset
|
||||||
let s:firstline = 2
|
let s:firstline = 2
|
||||||
" increase offset if there is a custom header
|
let s:firstline += len(g:startify_header)
|
||||||
if exists('g:startify_custom_header')
|
|
||||||
let s:firstline += len(g:startify_custom_header)
|
|
||||||
endif
|
|
||||||
" no special, no local Session.vim, but a section header
|
" no special, no local Session.vim, but a section header
|
||||||
if !s:show_special && !exists('l:show_session') && type(s:lists[0]) == 3
|
if !s:show_special && !exists('l:show_session') && type(s:lists[0]) == 3
|
||||||
let s:firstline += len(s:lists[0]) + 1
|
let s:firstline += len(s:lists[0]) + 1
|
||||||
|
@ -826,3 +826,4 @@ function! s:init_env()
|
||||||
let s:env = sort(s:env, 's:compare_by_key_len')
|
let s:env = sort(s:env, 's:compare_by_key_len')
|
||||||
let s:env = sort(s:env, 's:compare_by_val_len')
|
let s:env = sort(s:env, 's:compare_by_val_len')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
*startify.txt* Showing recently used stuff like a boss.
|
*startify.txt* The fancy start screen.
|
||||||
*startify*
|
*startify*
|
||||||
__ __ ___
|
__ __ ___
|
||||||
/\ \__ /\ \__ __ /'___\
|
/\ \__ /\ \__ __ /'___\
|
||||||
|
@ -10,10 +10,6 @@
|
||||||
/\___/
|
/\___/
|
||||||
\/__/
|
\/__/
|
||||||
by Marco Hinz~
|
by Marco Hinz~
|
||||||
|
|
||||||
Twitter: https://twitter.com/_mhinz_
|
|
||||||
Github: http://github.com/mhinz
|
|
||||||
IRC: mhi^ (Freenode)
|
|
||||||
>
|
>
|
||||||
If you use any of my plugins, please star them on github. It's a great way
|
If you use any of my plugins, please star them on github. It's a great way
|
||||||
of getting feedback and gives me the kick to put more time into their
|
of getting feedback and gives me the kick to put more time into their
|
||||||
|
@ -424,19 +420,17 @@ NOTE: There is no sanitizing going on, so you should know what you're doing!
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*g:startify_custom_header*
|
*g:startify_custom_header*
|
||||||
>
|
>
|
||||||
let g:startify_custom_header = ''
|
let g:startify_custom_header = startify#fortune#get_random_quote()
|
||||||
<
|
<
|
||||||
This is a list of single-quoted strings to be shown before everything else.
|
This is a list of strings to be shown before everything else. Every string
|
||||||
Every string will be written on its own line.
|
will be written on its own line, hence you can use empty strings for blank
|
||||||
|
lines.
|
||||||
|
|
||||||
NOTE: If a string contains ', you have to quote it with another '.
|
Simple example:~
|
||||||
|
|
||||||
A programmatic example:
|
|
||||||
>
|
>
|
||||||
let g:startify_custom_header =
|
let g:startify_custom_header = ['line 1', '', 'line 3']
|
||||||
\ map(split(system('fortune | cowsay'), '\n'), '" ". v:val') + ['','']
|
|
||||||
<
|
<
|
||||||
A hardcoded example:
|
More complex example:~
|
||||||
>
|
>
|
||||||
let g:startify_custom_header = [
|
let g:startify_custom_header = [
|
||||||
\ ' ________ __ __ ',
|
\ ' ________ __ __ ',
|
||||||
|
@ -446,11 +440,13 @@ A hardcoded example:
|
||||||
\ ' \ \ \_/ |\ \ \/\ \/\ \/\ \ /'' /''__ \ \__ ,__\',
|
\ ' \ \ \_/ |\ \ \/\ \/\ \/\ \ /'' /''__ \ \__ ,__\',
|
||||||
\ ' \ \___/ \ \_\ \_\ \_\ \_\ /\_/ /\_\ \/_/\_\_/ ',
|
\ ' \ \___/ \ \_\ \_\ \_\ \_\ /\_/ /\_\ \/_/\_\_/ ',
|
||||||
\ ' \/__/ \/_/\/_/\/_/\/_/ \// \/_/ \/_/ ',
|
\ ' \/__/ \/_/\/_/\/_/\/_/ \// \/_/ \/_/ ',
|
||||||
\ '',
|
|
||||||
\ '',
|
|
||||||
\ ]
|
\ ]
|
||||||
<
|
<
|
||||||
|
Programmatic example:~
|
||||||
|
>
|
||||||
|
let g:startify_custom_header =
|
||||||
|
\ map(split(system('fortune | cowsay'), '\n'), '" ". v:val')
|
||||||
|
<
|
||||||
Also have a look at |startify-faq-08|.
|
Also have a look at |startify-faq-08|.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
@ -760,7 +756,7 @@ How to use the output of a command as header?~
|
||||||
redir END
|
redir END
|
||||||
|
|
||||||
let g:startify_custom_header =
|
let g:startify_custom_header =
|
||||||
\ map(split(test), 'repeat(" ", 10) . v:val') + ['']
|
\ map(split(test), 'repeat(" ", 10) . v:val')
|
||||||
<
|
<
|
||||||
|:redir| puts a string into 'test'. Then we turn it into a list of strings.
|
|:redir| puts a string into 'test'. Then we turn it into a list of strings.
|
||||||
Then we shift each string to the right by 10 spaces. Afterwards we add an
|
Then we shift each string to the right by 10 spaces. Afterwards we add an
|
||||||
|
@ -841,9 +837,6 @@ This is my configuration..
|
||||||
let g:startify_custom_footer =
|
let g:startify_custom_footer =
|
||||||
\ ['', " Vim is charityware. Please read ':help uganda'.", '']
|
\ ['', " Vim is charityware. Please read ':help uganda'.", '']
|
||||||
|
|
||||||
let g:startify_custom_header =
|
|
||||||
\ map(split(system('tips | cowsay -f apt'), '\n'), '" ". v:val') + ['']
|
|
||||||
|
|
||||||
hi StartifyBracket ctermfg=240
|
hi StartifyBracket ctermfg=240
|
||||||
hi StartifyFile ctermfg=147
|
hi StartifyFile ctermfg=147
|
||||||
hi StartifyFooter ctermfg=240
|
hi StartifyFooter ctermfg=240
|
||||||
|
|
|
@ -27,9 +27,7 @@ syntax match StartifyFile /.*/ contains=
|
||||||
execute 'syntax match StartifySlash /\'. s:sep .'/'
|
execute 'syntax match StartifySlash /\'. s:sep .'/'
|
||||||
execute 'syntax match StartifyPath /\%9c.*\'. s:sep .'/ contains=StartifySlash,StartifyVar'
|
execute 'syntax match StartifyPath /\%9c.*\'. s:sep .'/ contains=StartifySlash,StartifyVar'
|
||||||
|
|
||||||
if exists('g:startify_custom_header')
|
execute 'syntax region StartifyHeader start=/\%1l/ end=/\%'. (len(g:startify_header) + 2) .'l/'
|
||||||
execute 'syntax region StartifyHeader start=/\%1l/ end=/\%'. (len(g:startify_custom_header) + 2) .'l/'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if exists('g:startify_custom_footer')
|
if exists('g:startify_custom_footer')
|
||||||
execute 'syntax region StartifyFooter start=/\%'. startify#get_lastline() .'l/ end=/*/'
|
execute 'syntax region StartifyFooter start=/\%'. startify#get_lastline() .'l/ end=/*/'
|
||||||
|
|
Loading…
Reference in a new issue