xmaslights.vim 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. python << EOL
  2. # xmaslights.vim
  3. # Version: 0.1
  4. # Author: Ryan (gt3 Kulla
  5. # Python script for Vim to make your text appear as animated Christmas lights
  6. #
  7. # You will not be able to use vim until you press ctrl+c to stop the script because this script makes
  8. # vim act like a screensaver. This script only changes the color of 'guifg' and was made and tested using
  9. # gvim 6.2 for win32. Modify it if needed.
  10. #
  11. # Usage:
  12. # (Note: you must have vim compiled with +python for this to work)
  13. # 1) Put xmaslights.vim in your Vim plugins directory.
  14. # 2) open a file that uses syntax highlighting like a .html file
  15. # 3) type ":py xmas()"
  16. import vim
  17. import time
  18. import random
  19. colors = ("red", "green") # feel free to add more colors
  20. attribs = ("comment", "underlined", "cursor", "constant", "identifier", "statement", "preproc", "type", "special", "error", "todo", "directory", "statusline", "normal", "search", "nontext", "errormsg", "warningmsg", "modemsg", "moremsg", "incsearch", "linenr", "title", "statuslinenc", "label", "operator", "clear visual", "visual", "diffchange", "difftext", "diffadd", "diffdelete", "folded", "foldedcolumn", "clf0") # take items out you know you don't want colorized
  21. def xmas():
  22. if not vim.eval("&syntax"):
  23. print "Open a file that uses syntax highlighting and try again."
  24. return
  25. while 1:
  26. for attrib in attribs:
  27. vim.command("hi %s guifg=%s" % (attrib, random.choice(colors)))
  28. time.sleep(1) # if this is too slow, use a fraction of a second like sleep(.3)
  29. vim.command("redraw")
  30. EOL