summaryrefslogtreecommitdiffstats
path: root/runtime/macros/hanoi/hanoi.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 08:50:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 08:50:31 +0000
commitaed8ce9da277f5ecffe968b324f242c41c3b752a (patch)
treed2e538394cb7a8a7c42a4aac6ccf1a8e3256999b /runtime/macros/hanoi/hanoi.vim
parentInitial commit. (diff)
downloadvim-aed8ce9da277f5ecffe968b324f242c41c3b752a.tar.xz
vim-aed8ce9da277f5ecffe968b324f242c41c3b752a.zip
Adding upstream version 2:9.0.1378.upstream/2%9.0.1378upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--runtime/macros/hanoi/hanoi.vim64
1 files changed, 64 insertions, 0 deletions
diff --git a/runtime/macros/hanoi/hanoi.vim b/runtime/macros/hanoi/hanoi.vim
new file mode 100644
index 0000000..1d075fa
--- /dev/null
+++ b/runtime/macros/hanoi/hanoi.vim
@@ -0,0 +1,64 @@
+set remap
+set noterse
+set wrapscan
+" to set the height of the tower, change the digit in the following
+" two lines to the height you want (select from 1 to 9)
+map t 7
+map! t 7
+map L 1G/t X/^0 $P1GJ$An$BGC0e$X0E0F$X/T @f @h $A1GJ@f0l$Xn$PU
+map g IL
+
+map J /^0[^t]*$
+map X x
+map P p
+map U L
+map A "fyl
+map B "hyl
+map C "fp
+map e "fy2l
+map E "hp
+map F "hy2l
+
+" initialisations:
+" KM cleanup buffer
+" Y create tower of desired height
+" NOQ copy it and insert a T
+" NO copy this one
+" S change last char into a $
+" R change last char in previous line into a n
+" T insert two lines containing a zero
+" V add a last line containing a backslash
+map I KMYNOQNOSkRTV
+
+"create empty line
+map K 1Go
+
+"delete to end of file
+map M dG
+
+"yank one line
+map N yy
+
+"put
+map O p
+
+"delete more than height-of-tower characters
+map q tllD
+
+"create a tower of desired height
+map Y o0123456789Z0q
+
+"insert a T in column 1
+map Q 0iT
+
+"substitute last character with a n
+map R $rn
+
+"substitute last character with a $
+map S $r$
+
+"insert two lines containing a zero
+map T ko0 0 
+
+"add a backslash at the end
+map V Go/