Created
March 10, 2012 15:06
-
-
Save emanon001/2011683 to your computer and use it in GitHub Desktop.
Vim script: One two three vai!(Haruka Amami shout)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Commands | |
command! -nargs=0 -bang Vai | |
\ call s:vai.vavai('<bang>' == '!') | |
" Variables | |
let s:vai = {} | |
" Preparation of initialization. | |
function! s:vai.__init__() | |
call self.__init_variables__() | |
endfunction | |
function! s:vai.__init_variables__() | |
let self.V = { | |
\ 'phrases': [ | |
\ 'ワン', | |
\ 'ツー', | |
\ 'スリー', | |
\ 'ゝノ゚ ヮ゚ノノヴァイ!' | |
\ ], | |
\ 'interval': '350m' | |
\ } | |
endfunction | |
" Functions | |
function! s:vai.vavai(is_bang) | |
if !a:is_bang | |
" Call again! | |
echohl WarningMsg | echomsg 'Vai! VaVai! Vai!' | echohl None | |
return | |
endif | |
call self.create_window('vai!') | |
call self.i_want() | |
endfunction | |
function! s:vai.create_window(bufname) | |
1new | |
setlocal bufhidden=wipe | |
setlocal buftype=nofile | |
setlocal noswapfile | |
setlocal nobuflisted | |
silent file `=a:bufname` | |
endfunction | |
function! s:vai.i_want() | |
for _ in self.V.phrases | |
call self.shout(_) | |
redraw | |
execute 'sleep' self.V.interval | |
endfor | |
close | |
endfunction | |
function! s:vai.shout(phrase) | |
call setline(1, a:phrase) | |
endfunction | |
" Init | |
call s:vai.__init__() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage