Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created September 10, 2012 06:37
Show Gist options
  • Save rhysd/3689258 to your computer and use it in GitHub Desktop.
Save rhysd/3689258 to your computer and use it in GitHub Desktop.
イヌゥ… ステータスライン
" This is イヌゥ… script for vim's status line.
" The original script is here.
" https://github.com/koron/homoo-vim
" All you have to do is to execute the below command.
" :source path/to/inuu.vim
scriptencoding utf-8
let s:save_cpo = &cpo
set cpo&vim
let s:pattern0 = [
\' (U^ω^) ',
\' -(U^ω^) ',
\' -(U^ω^) ',
\'-=(U^ω^) ',
\' -=(U^ω^) ',
\'-=≡(U>ω<) イヌゥ! ',
\' --=≡(U>ω<) イヌゥ! ',
\' --=≡(U>ω<) イヌゥ! ',
\' -=≡(U>ω<) イヌゥ! ',
\' -=(U>ω<) ',
\' -=(U>ω<) ',
\' -(Uーωー) ',
\' (Uーωー) ',
\' (Uーωー) イヌゥ…',
\' (Uーωー) イヌゥ…',
\' (Uーωー) イヌゥ…',
\' (Uーωー) イヌゥ…',
\]
let s:pattern_index = 0
let s:position = 0
function! Inuu()
let width = winwidth('.') / 2
let spacer = repeat(' ', width)
let whole = spacer.s:pattern0[s:pattern_index].spacer
let start = strwidth(whole) - width * 2 - s:position * 2
let last = start + width * 2
let retval = matchstr(whole, '\%>'.start.'v.*\%<'.last.'v')
" Update pattern and position for next frame.
let s:pattern_index += 1
if s:pattern_index >= len(s:pattern0)
let s:pattern_index = 0
let s:position += 5
if s:position >= winwidth('.') / 2 + 8
let s:position = 0
endif
endif
return retval
endfunction
set statusline=%{Inuu()}
let &cpo = s:save_cpo
unlet s:save_cpo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment