home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / AP / VIM / VIM-3.0 / VIM-3 / vim / macros / hanoi / hanoi.mac < prev    next >
Encoding:
Text File  |  1993-10-13  |  1.1 KB  |  65 lines

  1. set remap
  2. set noterse
  3. set wrapscan
  4. " to set the height of the tower, change the digit in the following
  5. " two lines to the height you want (select from 1 to 9)
  6. map t 7
  7. map! t 7
  8. map L 1G/t
  9. X/^0
  10. $P1GJ$An$BGC0e$X0E0F$X/T
  11. @f
  12. @h
  13. $A1GJ@f0l$Xn$PU
  14. map g IL
  15.  
  16. map J /^0[^t]*$
  17. map X x
  18. map P p
  19. map U L
  20. map A "fyl
  21. map B "hyl
  22. map C "fp
  23. map e "fy2l
  24. map E "hp
  25. map F "hy2l
  26.  
  27. " initialisations:
  28. " KM    cleanup buffer
  29. " Y    create tower of desired height
  30. " NOQ    copy it and inster a T
  31. " NO    copy this one
  32. " S    change last char into a $
  33. " R    change last char in previous line into a n
  34. " T    insert two lines containing a zero
  35. " V    add a last line containing a backslash
  36. map I KMYNOQNOSkRTV
  37.  
  38. "create empty line
  39. map K 1Go
  40.  
  41. "delete to end of file
  42. map M dG
  43.  
  44. "yank one line
  45. map N yy
  46.  
  47. "put
  48. map O p
  49.  
  50. "delete more than height-of-tower characters
  51. map q tllD
  52.  
  53. "create a tower of desired height
  54. map Y o0123456789Zq
  55.  
  56. "insert a T in column 1
  57. map Q 0iT
  58.  
  59. "substitute last character with a n
  60. map R $rn
  61.  
  62. "substitute last character with a $
  63. map S $r$
  64.  
  65. "insert two lines containing a zero
  66. map T ko0
  67. 0
  68.  
  69.  
  70. "add a backslash at the end
  71. map V Go/
  72.