catium.vim

add an element of nyan cat to vim
git clone git://edryd.org/catium.vim
Log | Files | Refs

catium.vim (1477B)


      1 " catium.vim - Add an Element of Nyan Cat to Vim
      2 " Author:  Ed van Bruggen
      3 " Version: 1.0
      4 " License: Vim License. See :help license
      5 
      6 scriptencoding utf-8
      7 
      8 if exists('g:loaded_catium')
      9   finish
     10 endif
     11 let g:loaded_catium = 1
     12 
     13 let s:traills = [
     14         \ ['='],
     15         \ ['/'],
     16         \ ['\'],
     17         \ ['\/'],
     18 \ ]
     19 
     20 let s:bodyls = [
     21         \ ['[]'],
     22         \ ['▩ '],
     23         \ ['□ '],
     24         \ ['[∴]'],
     25         \ ['[,_,]'],
     26 \ ]
     27 
     28 let s:facels = [
     29         \ ['*'],
     30         \ ['ه'],
     31         \ [':3'],
     32 \ ]
     33 
     34 let s:spacels = [
     35         \ ['-'],
     36         \ ['_'],
     37         \ ['∴ '],
     38         \ ['∵ '],
     39         \ ['∴∵'],
     40 \ ]
     41 
     42 function! g:Catium()
     43   let s:trailnum = get(g:, 'catium#trail', 0)
     44   let s:bodynum  = get(g:, 'catium#body', 0)
     45   let s:facenum  = get(g:, 'catium#face', 0)
     46   let s:spacenum = get(g:, 'catium#space', 0)
     47   if strlen(s:traills[s:trailnum][0]) == 1
     48     let s:trail = s:traills[s:trailnum][0].s:traills[s:trailnum][0]
     49   else
     50     let s:trail = s:traills[s:trailnum][0]
     51   endif
     52   if strlen(s:spacels[s:spacenum][0]) == 1
     53     let s:space = s:spacels[s:spacenum][0].s:spacels[s:spacenum][0]
     54   else
     55     let s:space = s:spacels[s:spacenum][0]
     56   endif
     57   let s:cat = s:bodyls[s:bodynum][0].s:facels[s:facenum][0]
     58   let s:totallen = winwidth(0) / 3 - strlen(s:cat)
     59   let s:traillen = line('.') * s:totallen / line('$') - 1
     60   let s:spacelen = s:totallen - s:traillen - 1
     61   return repeat(s:trail, s:traillen).s:cat.repeat(s:space, s:spacelen).' '
     62 endfunction
     63