Created
September 28, 2011 13:49
-
-
Save mattn/1247977 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:n = 1 | |
let s:q = '' | |
function! s:fizzbuzz() | |
if !len(s:q) | |
if s:n % 3 == 0 && s:n % 5 == 0 | |
let s:q = "fizzbuzz " | |
elseif s:n % 3 == 0 | |
let s:q = "fizz " | |
elseif s:n % 5 == 0 | |
let s:q = "buzz " | |
else | |
let s:q = s:n." " | |
endif | |
let s:n += 1 | |
endif | |
let v:char = s:q[0] | |
let s:q = s:q[1:] | |
endfunction | |
autocmd InsertCharPre <buffer> call s:fizzbuzz() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment