hanoi.vim 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 X/^0 $P1GJ$An$BGC0e$X0E0F$X/T @f @h $A1GJ@f0l$Xn$PU
  9. map g IL
  10. map J /^0[^t]*$
  11. map X x
  12. map P p
  13. map U L
  14. map A "fyl
  15. map B "hyl
  16. map C "fp
  17. map e "fy2l
  18. map E "hp
  19. map F "hy2l
  20. " initialisations:
  21. " KM cleanup buffer
  22. " Y create tower of desired height
  23. " NOQ copy it and insert a T
  24. " NO copy this one
  25. " S change last char into a $
  26. " R change last char in previous line into a n
  27. " T insert two lines containing a zero
  28. " V add a last line containing a backslash
  29. map I KMYNOQNOSkRTV
  30. "create empty line
  31. map K 1Go
  32. "delete to end of file
  33. map M dG
  34. "yank one line
  35. map N yy
  36. "put
  37. map O p
  38. "delete more than height-of-tower characters
  39. map q tllD
  40. "create a tower of desired height
  41. map Y o0123456789Z0q
  42. "insert a T in column 1
  43. map Q 0iT
  44. "substitute last character with a n
  45. map R $rn
  46. "substitute last character with a $
  47. map S $r$
  48. "insert two lines containing a zero
  49. map T ko0 0 
  50. "add a backslash at the end
  51. map V Go/