Skip to content

Instantly share code, notes, and snippets.

@mattn
Created September 28, 2011 13:49
Show Gist options
  • Save mattn/1247977 to your computer and use it in GitHub Desktop.
Save mattn/1247977 to your computer and use it in GitHub Desktop.
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