mhinz / vim-startify

:link: The fancy start screen for Vim.
MIT License
5.31k stars 186 forks source link

something about startify_custom_header #108

Closed axiaoxin closed 10 years ago

axiaoxin commented 10 years ago

It's nice, I wanna kown how to display the animal pattern which in the screenshot, thanks, and I don's think it is cowsay in startify_custom_header.

and how to generate to ascii picture which like the hardcoded example 'vim 7.3' , thanks a lot.

mhinz commented 10 years ago

Actually, it is cowsay. :-) Have a look at :h startify-example, it shows my exact configuration:

let g:startify_custom_header =
        \ map(split(system('tips | cowsay -f apt'), '\n'), '"   ". v:val') + ['']

Whereas tips is this https://github.com/mhinz/dotfiles/blob/master/bin/tips

And here's an hardcoded example:

let g:startify_custom_header = [
            \ '                                 ________  __ __        ',
            \ '            __                  /\_____  \/\ \\ \       ',
            \ '    __  __ /\_\    ___ ___      \/___//''/''\ \ \\ \    ',
            \ '   /\ \/\ \\/\ \ /'' __` __`\        /'' /''  \ \ \\ \_ ',
            \ '   \ \ \_/ |\ \ \/\ \/\ \/\ \      /'' /''__  \ \__ ,__\',
            \ '    \ \___/  \ \_\ \_\ \_\ \_\    /\_/ /\_\  \/_/\_\_/  ',
            \ '     \/__/    \/_/\/_/\/_/\/_/    \//  \/_/     \/_/    ',
            \ '',
            \ '',
            \ ]

Yes, it doesn't look exactly right here, but will when it get displayed in Vim. (Sometimes you have to escape certain things to make it look right.) I used http://www.figlet.org to generate the ASCII.

axiaoxin commented 10 years ago

thank you very much.

mhinz commented 10 years ago

You're welcome!

tolinwei commented 9 years ago

@mhinz Hi, after adding this line to my vimrc, the cowsay is still not showing let g:startify_custom_header = \ map(split(system('tips | cowsay -f apt'), '\n'), '" ". v:val') + ['']

Do I need to do some extra configuration around this repo? https://github.com/mhinz/dotfiles/blob/master/bin/tips

mhinz commented 9 years ago

There's a rogue \. :-) It's just needed if you break the assignment up into multiple lines.

I'm using this at the moment:

function! s:center_header(lines) abort
  let longest_line   = max(map(copy(a:lines), 'len(v:val)'))
  let centered_lines = map(copy(a:lines), 'repeat(" ", (&columns / 2) - (longest_line / 2)) . v:val')
  return centered_lines
endfunction

let g:startify_custom_header = s:center_header(split(system('tips | cowsay -f apt')), '\n'))

It's basically the same, but also centers the header.

And you should be able to run tips from the shell, of course. (So, it has to be in your shell's $PATH variable.)