Created
March 11, 2016 16:27
-
-
Save heavenshell/e6cf261d28bf8ead9a9f to your computer and use it in GitHub Desktop.
This file contains 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
let s:save_cpo = &cpo | |
set cpo&vim | |
function! s:rand(list) | |
let s:choice = '' | |
py << endpy | |
def _choice(l): | |
import random | |
import vim | |
ret = random.choice(l) | |
vim.command('let s:choice = "%s"' % ret) | |
endpy | |
python _choice(vim.eval('a:list')) | |
return s:choice | |
endfunction | |
function! Zundoko() | |
let success = 'ズンズンズンズンドコ' | |
let zundoko = ['ズン', 'ドコ'] | |
let zd = [] | |
while 1 | |
let word = s:rand(zundoko) | |
call add(zd, word) | |
if join(zd, '') == success | |
break | |
endif | |
if len(zd) == 5 | |
let zd = [] | |
endif | |
endwhile | |
echomsg printf('%s キ・ヨ・シ!', success) | |
endfunction | |
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