Skip to content

Instantly share code, notes, and snippets.

@emanon001
Created March 10, 2012 15:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emanon001/2011683 to your computer and use it in GitHub Desktop.
Save emanon001/2011683 to your computer and use it in GitHub Desktop.
Vim script: One two three vai!(Haruka Amami shout)
" 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__()
@emanon001
Copy link
Author

Usage

:Vai!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment