Skip to content

Instantly share code, notes, and snippets.

@heavenshell
Forked from rhysd/inuu.vim
Created September 10, 2012 09:55
Show Gist options
  • Save heavenshell/3690038 to your computer and use it in GitHub Desktop.
Save heavenshell/3690038 to your computer and use it in GitHub Desktop.
イッテヨシ! ステータスライン
" This is イッテヨシ! script in status line.
" The original script is here.
" https://github.com/koron/homoo-vim
" https://gist.github.com/3689258
" All you have to do is execute below command.
" :source path/to/gikoneko.vim
scriptencoding utf-8
let s:save_cpo = &cpo
set cpo&vim
let s:pattern0 = [
\" ~(,,゚Д゚) ",
\" -~(,,゚Д゚) ",
\" -=~(,,゚Д゚) ",
\" -=~(,,゚Д゚) ",
\" -=≡~(,,゚Д゚) ",
\" -=≡~(,,゚Д゚)< イッテヨシ!",
\"--=≡~(,,゚Д゚)< イッテヨシ!",
\"--=≡~(,,゚Д゚)< イッテヨシ!",
\" -=≡~(,,゚Д゚)< イッテヨシ!",
\" -=~(,,゚Д゚) ",
\" -~(,,゚Д゚) ",
\" ~(,,゚Д゚) ",
\]
let s:pattern_index = 0
let s:position = 0
function! Gikoneko()
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 += 1
if s:position >= winwidth('.') / 2 + 8
let s:position = 0
endif
endif
return retval
endfunction
set statusline=%{Gikoneko()}
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