Language Vim
Date: | 09/18/08 |
Author: | Jim Eberle |
URL: | http://www.fastnlight.com |
Comments: | 0 |
Info: | http://www.vim.org |
Score: | (2.86 in 7 votes) |
" Vim version. Vim is a mighty vi clone. http://www.vim.org. " Source and call w/ ':so % | BeerSong'. Output is written to buffer 'beer-song' fun! s:beer_song(n) new beer-song only let i = a:n while i > 0 put =printf('%s of beer on the wall, %s of beer.', s:btls(i), s:btls(i)) let i -= 1 put =printf('Take one down and pass it around, %s of beer on the wall.', s:btls(i)) put ='' endw put ='No more bottles of beer on the wall, no more bottles of beer.' put =printf('Go to the store and buy some more, %s of beer on the wall.', s:btls(a:n)) 1d set nomodified endf fun! s:btls(n) let c = (a:n > 0) ? a:n : 'no more' let s = (a:n == 1) ? '' : 's' return printf('%s bottle%s', c, s) endf com! -nargs=0 -count=99 -bar BeerSong call s:beer_song(<count>)
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments