diff options
Diffstat (limited to 'runtime/macros')
37 files changed, 1269 insertions, 0 deletions
diff --git a/runtime/macros/README.txt b/runtime/macros/README.txt new file mode 100644 index 0000000..22f9a97 --- /dev/null +++ b/runtime/macros/README.txt @@ -0,0 +1,33 @@ +The macros in the maze, hanoi and urm directories can be used to test Vim for +vi compatibility. They have been written for vi to show its unlimited +possibilities. The life macros can be used for performance comparisons. + +hanoi Macros that solve the tower of hanoi problem. +life Macros that run Conway's game of life. +maze Macros that solve a maze (amazing!). +urm Macros that simulate a simple computer: "Universal Register Machine" + + + +The other files contain some handy utilities. They also serve as examples for +how to use Vi and Vim functionality. + +less.sh + less.vim make Vim work like less (or more) + + + +The following have been moved to an optional package. Add the command to your +vimrc file to use the package: + +packadd! dvorak " Dvorak keyboard support; adds mappings + +packadd! editexisting " when editing a file that is already edited with + " another Vim instance, go to that Vim instance + +packadd! justify " justifying text. + +packadd! matchit " makes the % command work better + +packadd! shellmenu " menus for editing shell scripts in the GUI version + +packadd! swapmouse " swap left and right mouse buttons diff --git a/runtime/macros/README.txt.info b/runtime/macros/README.txt.info Binary files differnew file mode 100644 index 0000000..d173e72 --- /dev/null +++ b/runtime/macros/README.txt.info diff --git a/runtime/macros/editexisting.vim b/runtime/macros/editexisting.vim new file mode 100644 index 0000000..6e8f74f --- /dev/null +++ b/runtime/macros/editexisting.vim @@ -0,0 +1,3 @@ +" Load the editexisting package. +" For those users who were loading the editexisting plugin from here. +packadd editexisting diff --git a/runtime/macros/hanoi.info b/runtime/macros/hanoi.info Binary files differnew file mode 100644 index 0000000..8072e56 --- /dev/null +++ b/runtime/macros/hanoi.info diff --git a/runtime/macros/hanoi/click.me b/runtime/macros/hanoi/click.me new file mode 100644 index 0000000..24f178b --- /dev/null +++ b/runtime/macros/hanoi/click.me @@ -0,0 +1,14 @@ + + +See Vim solve the towers of Hanoi! + +Instructions: + type ":so hanoi.vim<RETURN>" to load the macros + type "g" to start it + +and watch it go. + + to quit type ":q!<RETURN>" +to interrupt type CTRL-C + +(This text will disappear as soon as you type "g") diff --git a/runtime/macros/hanoi/click.me.info b/runtime/macros/hanoi/click.me.info Binary files differnew file mode 100644 index 0000000..f38cb5a --- /dev/null +++ b/runtime/macros/hanoi/click.me.info diff --git a/runtime/macros/hanoi/hanoi.vim b/runtime/macros/hanoi/hanoi.vim new file mode 100644 index 0000000..834d6f2 --- /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 inster 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/ diff --git a/runtime/macros/hanoi/poster b/runtime/macros/hanoi/poster new file mode 100644 index 0000000..dd03b26 --- /dev/null +++ b/runtime/macros/hanoi/poster @@ -0,0 +1,36 @@ +Article 2913 of alt.sources: +Path: oce-rd1!hp4nl!mcsun!uunet!munnari.oz.au!metro!cluster!swift!softway!otc!gregm +From: gregm@otc.otca.oz.au (Greg McFarlane) +Newsgroups: comp.sources.d,alt.sources,comp.editors +Subject: VI SOLVES HANOI +Message-ID: <2323@otc.otca.oz> +Date: 19 Feb 91 01:32:14 GMT +Sender: news@otc.otca.oz +Reply-To: gregm@otc.otca.oz.au (Greg McFarlane) +Organization: OTC Development Unit, Australia +Lines: 80 +Xref: oce-rd1 comp.sources.d:5702 alt.sources:2913 comp.editors:2313 + +Submitted-by: gregm@otc.otca.oz.au +Archive-name: hanoi.vi.macros/part01 + +Everyone seems to be writing stupid Tower of Hanoi programs. +Well, here is the stupidest of them all: the hanoi solving vi macros. + +Save this article, unshar it, and run uudecode on hanoi.vi.macros.uu. +This will give you the macro file hanoi.vi.macros. +Then run vi (with no file: just type "vi") and type: + :so hanoi.vi.macros + g +and watch it go. + +The default height of the tower is 7 but can be easily changed by editing +the macro file. + +The disks aren't actually shown in this version, only numbers representing +each disk, but I believe it is possible to write some macros to show the +disks moving about as well. Any takers? + +(For maze solving macros, see alt.sources or comp.editors) + +Greg diff --git a/runtime/macros/hanoi/poster.info b/runtime/macros/hanoi/poster.info Binary files differnew file mode 100644 index 0000000..780fa35 --- /dev/null +++ b/runtime/macros/hanoi/poster.info diff --git a/runtime/macros/justify.vim b/runtime/macros/justify.vim new file mode 100644 index 0000000..011a911 --- /dev/null +++ b/runtime/macros/justify.vim @@ -0,0 +1,3 @@ +" Load the justify package. +" For those users who were loading the justify plugin from here. +packadd justify diff --git a/runtime/macros/less.bat b/runtime/macros/less.bat new file mode 100644 index 0000000..bbe619b --- /dev/null +++ b/runtime/macros/less.bat @@ -0,0 +1,10 @@ +@echo off +rem batch file to start Vim with less.vim. +rem Read stdin if no arguments were given. +rem Written by Ken Takata. + +if "%1"=="" ( + vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" - +) else ( + vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %* +) diff --git a/runtime/macros/less.sh b/runtime/macros/less.sh new file mode 100755 index 0000000..e29958f --- /dev/null +++ b/runtime/macros/less.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Shell script to start Vim with less.vim. +# Read stdin if no arguments were given and stdin was redirected. + +if test -t 1; then + if test $# = 0; then + if test -t 0; then + echo "Missing filename" 1>&2 + exit + fi + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - + else + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" + fi +else + # Output is not a terminal, cat arguments or stdin + if test $# = 0; then + if test -t 0; then + echo "Missing filename" 1>&2 + exit + fi + cat + else + cat "$@" + fi +fi diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim new file mode 100644 index 0000000..17433f4 --- /dev/null +++ b/runtime/macros/less.vim @@ -0,0 +1,292 @@ +" Vim script to work like "less" +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2020 Dec 17 + +" Avoid loading this file twice, allow the user to define his own script. +if exists("loaded_less") + finish +endif +let loaded_less = 1 + +" If not reading from stdin, skip files that can't be read. +" Exit if there is no file at all. +if argc() > 0 + let s:i = 0 + while 1 + if filereadable(argv(s:i)) + if s:i != 0 + sleep 3 + endif + break + endif + if isdirectory(argv(s:i)) + echomsg "Skipping directory " . argv(s:i) + elseif getftime(argv(s:i)) < 0 + echomsg "Skipping non-existing file " . argv(s:i) + else + echomsg "Skipping unreadable file " . argv(s:i) + endif + echo "\n" + let s:i = s:i + 1 + if s:i == argc() + quit + endif + next + endwhile +endif + +" we don't want 'compatible' here +if &cp + set nocp +endif + +" enable syntax highlighting if not done already +if !get(g:, 'syntax_on', 0) + syntax enable +endif + +set so=0 +set hlsearch +set incsearch +nohlsearch +" Don't remember file names and positions +set viminfo= +set nows +" Inhibit screen updates while searching +let s:lz = &lz +set lz + +" Allow the user to define a function, which can set options specifically for +" this script. +if exists('*LessInitFunc') + call LessInitFunc() +endif + +" Used after each command: put cursor at end and display position +if &wrap + noremap <SID>L L0:redraw<CR>:file<CR> + au VimEnter * normal! L0 +else + noremap <SID>L Lg0:redraw<CR>:file<CR> + au VimEnter * normal! Lg0 +endif + +" When reading from stdin don't consider the file modified. +au VimEnter * set nomod + +" Can't modify the text or write the file. +set nomodifiable readonly + +" Give help +noremap h :call <SID>Help()<CR> +map H h +fun! s:Help() + echo "<Space> One page forward b One page backward" + echo "d Half a page forward u Half a page backward" + echo "<Enter> One line forward k One line backward" + echo "G End of file g Start of file" + echo "N% percentage in file" + echo "\n" + echo "/pattern Search for pattern ?pattern Search backward for pattern" + echo "n next pattern match N Previous pattern match" + if &foldmethod != "manual" + echo "\n" + echo "zR open all folds zm increase fold level" + endif + echo "\n" + echo ":n<Enter> Next file :p<Enter> Previous file" + echo "\n" + echo "q Quit v Edit file" + let i = input("Hit Enter to continue") +endfun + +" Scroll one page forward +noremap <script> <Space> :call <SID>NextPage()<CR><SID>L +map <C-V> <Space> +map f <Space> +map <C-F> <Space> +map <PageDown> <Space> +map <kPageDown> <Space> +map <S-Down> <Space> +" If 'foldmethod' was changed keep the "z" commands, e.g. "zR" to open all +" folds. +if &foldmethod == "manual" + map z <Space> +endif +map <Esc><Space> <Space> +fun! s:NextPage() + if line(".") == line("$") + if argidx() + 1 >= argc() + " Don't quit at the end of the last file + return + endif + next + 1 + else + exe "normal! \<C-F>" + endif +endfun + +" Re-read file and page forward "tail -f" +map F :e<CR>G<SID>L:sleep 1<CR>F + +" Scroll half a page forward +noremap <script> d <C-D><SID>L +map <C-D> d + +" Scroll one line forward +noremap <script> <CR> <C-E><SID>L +map <C-N> <CR> +map e <CR> +map <C-E> <CR> +map j <CR> +map <C-J> <CR> +map <Down> <CR> + +" Scroll one page backward +noremap <script> b <C-B><SID>L +map <C-B> b +map <PageUp> b +map <kPageUp> b +map <S-Up> b +map w b +map <Esc>v b + +" Scroll half a page backward +noremap <script> u <C-U><SID>L +noremap <script> <C-U> <C-U><SID>L + +" Scroll one line backward +noremap <script> k <C-Y><SID>L +map y k +map <C-Y> k +map <C-P> k +map <C-K> k +map <Up> k + +" Redraw +noremap <script> r <C-L><SID>L +noremap <script> <C-R> <C-L><SID>L +noremap <script> R <C-L><SID>L + +" Start of file +noremap <script> g gg<SID>L +map < g +map <Esc>< g +map <Home> g +map <kHome> g + +" End of file +noremap <script> G G<SID>L +map > G +map <Esc>> G +map <End> G +map <kEnd> G + +" Go to percentage +noremap <script> % %<SID>L +map p % + +" Search +noremap <script> / H$:call <SID>Forward()<CR>/ +if &wrap + noremap <script> ? H0:call <SID>Backward()<CR>? +else + noremap <script> ? Hg0:call <SID>Backward()<CR>? +endif + +fun! s:Forward() + " Searching forward + noremap <script> n H$nzt<SID>L + if &wrap + noremap <script> N H0Nzt<SID>L + else + noremap <script> N Hg0Nzt<SID>L + endif + cnoremap <silent> <script> <CR> <CR>:cunmap <lt>CR><CR>zt<SID>L +endfun + +fun! s:Backward() + " Searching backward + if &wrap + noremap <script> n H0nzt<SID>L + else + noremap <script> n Hg0nzt<SID>L + endif + noremap <script> N H$Nzt<SID>L + cnoremap <silent> <script> <CR> <CR>:cunmap <lt>CR><CR>zt<SID>L +endfun + +call s:Forward() +cunmap <CR> + +" Quitting +noremap q :q<CR> + +" Switch to editing (switch off less mode) +map v :silent call <SID>End()<CR> +fun! s:End() + set ma + if exists('s:lz') + let &lz = s:lz + endif + unmap h + unmap H + unmap <Space> + unmap <C-V> + unmap f + unmap <C-F> + unmap z + unmap <Esc><Space> + unmap F + unmap d + unmap <C-D> + unmap <CR> + unmap <C-N> + unmap e + unmap <C-E> + unmap j + unmap <C-J> + unmap b + unmap <C-B> + unmap w + unmap <Esc>v + unmap u + unmap <C-U> + unmap k + unmap y + unmap <C-Y> + unmap <C-P> + unmap <C-K> + unmap r + unmap <C-R> + unmap R + unmap g + unmap < + unmap <Esc>< + unmap G + unmap > + unmap <Esc>> + unmap % + unmap p + unmap n + unmap N + unmap q + unmap v + unmap / + unmap ? + unmap <Up> + unmap <Down> + unmap <PageDown> + unmap <kPageDown> + unmap <PageUp> + unmap <kPageUp> + unmap <S-Down> + unmap <S-Up> + unmap <Home> + unmap <kHome> + unmap <End> + unmap <kEnd> +endfun + +" vim: sw=2 diff --git a/runtime/macros/life/click.me b/runtime/macros/life/click.me new file mode 100644 index 0000000..c2ed469 --- /dev/null +++ b/runtime/macros/life/click.me @@ -0,0 +1,9 @@ + +To run the "Conway's game of life" macros: + + 1. Type ":so life.vim". This loads the macros. + 2. Type "g" to run the macros. + 3. Type CTRL-C to interrupt. + 4. Type ":q!" to get out. + +See life.vim for more advanced usage. diff --git a/runtime/macros/life/click.me.info b/runtime/macros/life/click.me.info Binary files differnew file mode 100644 index 0000000..f575650 --- /dev/null +++ b/runtime/macros/life/click.me.info diff --git a/runtime/macros/life/life.vim b/runtime/macros/life/life.vim new file mode 100644 index 0000000..29832f0 --- /dev/null +++ b/runtime/macros/life/life.vim @@ -0,0 +1,262 @@ +" Macros to play Conway's Game of Life in vi +" Version 1.0m: edges wrap +" by Eli-the-Bearded Benjamin Elijah Griffin <vim@eli.users.panix.com> +" Sept 1996 +" This file may be free distributed so long as these credits remain unchanged. +" +" Modified by Bram Moolenaar (Bram@vim.org), 1996 Sept 10 +" - Made it quite a bit faster, but now needs search patterns in the text +" - Changed the order of mappings to top-down. +" - Made "g" run the whole thing, "C" run one generation. +" - Added support for any uppercase character instead of 'X' +" +" Rules: +" If a germ has 0 or 1 live neighbors it dies of loneliness +" If a germ has 2 or 3 live neighbors it survives +" If a germ has 4 to 8 live neighbors it dies of starvation +" If an empty box has 3 live neighbors a new germ is born +" +" A new born germ is an "A". Every generation it gets older: B, C, etc. +" A germ dies of old age when it reaches "Z". +" +" Notice the rules do not mention edges. This version has the edges wrap +" around. I have an earlier version that offers the option of live edges or +" dead edges. Email me if you are interested. -Eli- +" +" Note: This is slow! One generation may take up to ten minutes (depends on +" your computer and the vi version). +" +" Quite a lot of the messy stuff is to work around the vi error "Can't yank +" inside global/macro". Still doesn't work for all versions of vi. +" +" To use these macros: +" +" vi start vi/vim +" +" :so life.mac Source this file +" +" g 'g'o! runs everything until interrupted: "IR". +" +" I Initialize everything. A board will be drawn at the end +" of the current buffer. All line references in these macros +" are relative to the end of the file and playing the game +" can be done safely with any file as the current buffer. +" +" Change the left field with spaces and uppercase letters to suit +" your taste. +" +" C 'C'ompute one generation. +" + idem, time running one generation. +" R 'R'un 'C'ompute until interrupted. +" i<nr><Esc>z Make a number the only thing on the current line and use +" 'z' to time that many generations. +" +" Time to run 30 generations on my 233 AMD K6 (FreeBSD 3.0): +" vim 5.4 xterm 51 sec +" gvim 5.4 Athena 42 sec +" gvim 5.4 Motif 42 sec +" gvim 5.4 GTK 50 sec +" nvi 1.79 xterm 58 sec +" vi 3.7 xterm 2 min 30 sec +" Elvis 2.1 xterm 7 min 50 sec +" Elvis 2.1 X11 6 min 31 sec +" +" Time to run 30 generations on my 850 AMD Duron (FreeBSD 4.2): +" vim 5.8 xterm 21 sec +" vim 6.0 xterm 24 sec +" vim 6.0 Motif 32 sec +" nvi 1.79 xterm 29 sec +" vi 3.7 xterm 32 sec +" elvis 2.1.4 xterm 34 sec +" +" And now the macros, more or less in top-down order. +" +" ----- macros that can be used by the human ----- +" +" 'g'o: 'I'nitialize and then 'R'un 'C'ompute recursively (used by the human) +map g IR +" +" +" 'R'un 'C'ompute recursively (used by the human and 'g'o) +map R CV +" work around "tail recursion" problem in vi, "V" == "R". +map V R +" +" +" 'I'nitialize the board (used by the human and 'g'o) +map I G)0)0)0)0)1)0)0)2)0)0)0)0,ok,-11k,-,R,IIN +" +" +" 'C'ompute next generation (used by the human and others) +map C T>>>>>>>>B& +" +" +" Time running one generation (used by the human) +map + <1C<2 +" +" +" Time running N generations, where N is the number on the current line. +" (used by the human) +map z ,^,&,*,&<1,*<2 +" +" ----- END of macros that can be used by the human ----- +" +" ----- Initialisation ----- +" +map ,- :s/./-/g
+map ,o oPut 'X's in the left box, then hit 'C' or 'R' +map ,R 03stop +" +" Write a new line (used by 'I'nitialize board) +" In remembrance of John Conway, 26 December 1937 – 11 April 2020. +map )0 o- --....................--....................- +map )1 o- JOHN CONWAY --....................--....................- +map )2 o- LIVES --....................--....................- +" +" +" Initialisation of the pattern/command to execute for working out a square. +" Pattern is: "#<germ><count>" +" where <germ> is " " if the current germ is dead, "X" when living. +" <count> is the number of living neighbours (including current germ) +" expressed in X's +" +map ,Il8 O#XXXXXXXXXX .`a22lr +map ,Id8 o# XXXXXXXX .`a22lr +map ,Il7 o#XXXXXXXXX .`a22lr +map ,Id7 o# XXXXXXX .`a22lr +map ,Il6 o#XXXXXXXX .`a22lr +map ,Id6 o# XXXXXX .`a22lr +map ,Il5 o#XXXXXXX .`a22lr +map ,Id5 o# XXXXX .`a22lr +map ,Il4 o#XXXXXX .`a22lr +map ,Id4 o# XXXX .`a22lr +map ,Il3 o#XXXXX .,a +map ,Id3 o# XXX .`a22lrA +map ,Il2 o#XXXX .,a +map ,Id2 o# XX .`a22lr +map ,Il1 o#XXX .`a22lr +map ,Id1 o# X .`a22lr +map ,Il0 o#XX .`a22lr +map ,Id0 o# .`a22lr +" +" Patterns used to replace a germ with its next generation +map ,Iaa o=AB =BC =CD =DE =EF =FG =GH =HI =IJ =JK =KL =LM =MN =NO =OP =PQ =QR +map ,Iab o=RS =ST =TU =UV =VW =WX =XY =YZ =Z +" +" Insert the searched patterns above the board +map ,IIN G?^top
,Il8,Id8,Il7,Id7,Il6,Id6,Il5,Id5,Il4,Id4,Il3,Id3,Il2,Id2,Il1,Id1,Il0,Id0,Iaa,Iab +" +" ----- END of Initialisation ----- +" +" ----- Work out one line ----- +" +" Work out 'T'op line (used by show next) +map T G,c2k,!9k,@,#j>2k,$j +" +" Work out 'B'ottom line (used by show next) +map B ,%k>,$ +" +" Work out a line (used by show next, work out top and bottom lines) +map > 0 LWWWWWWWWWWWWWWWWWW,rj +" +" Refresh board (used by show next) +map & :%s/^\(-[ A-Z]*-\)\(-[ A-Z]*-\)\(-[.]*-\)$/\2\3\3/
+" +" +" Work around vi multiple yank/put in a single macro limitation +" (used by work out top and/or bottom line) +map ,$ dd +map ,% "cp +map ,! "byy +map ,@ "cyy +map ,# "bP +map ,c c$ +" +" ----- END of Work out one line ----- +" +" ----- Work out one square ----- +" +" The next three work out a square: put all nine chars around the current +" character on the bottom line (the bottom line must be empty when starting). +" +" 'W'ork out a center square (used by work out line) +map W makh,3`ah,3`ajh,3( +" +" +" Work out a 'L'eft square (used by work out line) +map L makf-h,1`ak,2`af-h,1`a,2`ajf-h,1`aj,2( +" +" +" Work out a 'R'ight square (used by work out line) +map ,r makh,2`akF-l,1`ah,2`aF-l,1`ajh,2`ajF-l,1( +" +" 'M'ove a character to the end of the file (used by all work out square +" macros) +" +map ,1 y G$p +map ,2 2y G$p +map ,3 3y G$p +" +" +" ----- END of Work out one square ----- +" +" ----- Work out one germ ----- +" +" Generate an edit command that depends on the number of living in the last +" line, and then run the edit command. (used by work out square). +" Leaves the cursor on the next character to be processed. +" +map ( ,s,i,X0i?^#A
0,df.l,Y21h +" +" Delete 's'paces (deads); +" The number of remaining characters is the number of living neighbours. +map ,s :.g/ /s///g
+" +" Insert current character in the last line +map ,i `ay GP +" +" Replace any uppercase letter with 'X'; +map ,X :.g/[A-Z]/s//X/g
+" +" Delete and execute the rest of the line +map ,d "qd$@q +" +" Yank and execute the rest of the line +map ,Y "qy$@q +" +" Yank the character under the cursor +map ,j y +" +" Put the current cut buffer after the cursor +map ,m p +" +" Delete the character under the cursor +map ,n x +" +" Replace a character by its next, A --> B, B --> C, etc. +map ,a `a,jGi?=,ma
0,dll,j`a21l,ml,nh +" +" ----- END of Work out one germ ----- +" +" ----- timing macros ----- +" +" Get current date (used by time a generation) +map << :r!date
+map <1 G?^top
O<< +map <2 G?^top
k<< +" +" +" Turn number on current line into edit command (used by time N generations) +map ,^ AiC +" +" +" Delete current line and save current line (used by time N generations) +map ,& 0"gd$ +" +" +" Run saved line (used by time N generations) +map ,* @g +" +" ----- END of timing macros ----- +" +" End of the macros. diff --git a/runtime/macros/matchit.vim b/runtime/macros/matchit.vim new file mode 100644 index 0000000..f6f463f --- /dev/null +++ b/runtime/macros/matchit.vim @@ -0,0 +1,5 @@ +" Load the matchit package. +" For those users who were loading the matchit plugin from here. +if 1 + packadd matchit +endif diff --git a/runtime/macros/maze.info b/runtime/macros/maze.info Binary files differnew file mode 100644 index 0000000..2ad27db --- /dev/null +++ b/runtime/macros/maze.info diff --git a/runtime/macros/maze/Makefile b/runtime/macros/maze/Makefile new file mode 100644 index 0000000..c34e115 --- /dev/null +++ b/runtime/macros/maze/Makefile @@ -0,0 +1,7 @@ +# It's simple... + +maze: mazeansi.c + cc -o maze mazeansi.c + +mazeclean: mazeclean.c + cc -o mazeclean mazeclean.c diff --git a/runtime/macros/maze/README.txt b/runtime/macros/maze/README.txt new file mode 100644 index 0000000..be8e8ef --- /dev/null +++ b/runtime/macros/maze/README.txt @@ -0,0 +1,49 @@ +To run the maze macros with Vim: + + vim -u maze_mac maze_5.78 + press "g" + +The "-u maze.mac" loads the maze macros and skips loading your .vimrc, which +may contain settings and mappings that get in the way. + + +The original README: + +To prove that you can do anything in vi, I wrote a couple of macros that +allows vi to solve mazes. It will solve any maze produced by maze.c +that was posted to the net recently. + +Just follow this recipe and SEE FOR YOURSELF. + 1. run uudecode on the file "maze.vi.macros.uu" to + produce the file "maze.vi.macros" + (If you can't wait to see the action, jump to step 4) + 2. compile maze.c with "cc -o maze maze.c" + 3. run maze > maze.out and input a small number (for example 10 if + you are on a fast machine, 3-5 if slow) which + is the size of the maze to produce + 4. edit the maze (vi maze.out) + 5. include the macros with the vi command: + :so maze.vi.macros + 6. type the letter "g" (for "go") and watch vi solve the maze + 7. when vi solves the maze, you will see why it lies + 8. now look at maze.vi.macros and all will be revealed + +Tested on a sparc, a sun and a pyramid (although maze.c will not compile +on the pyramid). + +Anyone who can't get the maze.c file to compile, get a new compiler, +try maze.ansi.c which was also posted to the net. +If you can get it to compile but the maze comes out looking like a fence +and not a maze and you are using SysV or DOS replace the "27" on the +last line of maze.c by "11" +Thanks to John Tromp (tromp@piring.cwi.nl) for maze.c. +Thanks to antonyc@nntp-server.caltech.edu (Bill T. Cat) for maze.ansi.c. + +Any donations should be in unmarked small denomination bills :^)=. + + ACSnet: gregm@otc.otca.oz.au +Greg McFarlane UUCP: {uunet,mcvax}!otc.otca.oz.au!gregm +|||| OTC || Snail: OTC R&D GPO Box 7000, Sydney 2001, Australia + Phone: +61 2 287 3139 Fax: +61 2 287 3299 + + diff --git a/runtime/macros/maze/README.txt.info b/runtime/macros/maze/README.txt.info Binary files differnew file mode 100644 index 0000000..263ddcd --- /dev/null +++ b/runtime/macros/maze/README.txt.info diff --git a/runtime/macros/maze/maze.c b/runtime/macros/maze/maze.c new file mode 100644 index 0000000..b917453 --- /dev/null +++ b/runtime/macros/maze/maze.c @@ -0,0 +1,7 @@ +char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C); +-- E; J[ E] =T +[E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|" +) , A = 39 ,C -- +) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C +& A == T[ A] +|6<<27<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];} diff --git a/runtime/macros/maze/maze_5.78 b/runtime/macros/maze/maze_5.78 new file mode 100644 index 0000000..dbe3d27 --- /dev/null +++ b/runtime/macros/maze/maze_5.78 @@ -0,0 +1,16 @@ +._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ +| ._| . . ._| | |_._._. . ._|_._._._._. ._|_. ._|_._. ._| . ._|_. | . ._._. | +| ._|_| |_. | | | | ._._|_._|_._. . |_. | | | ._._| |_._._| | ._. ._| . . |_| +|_._._._. | ._|_. ._._._. | | ._. |_._. . | ._._| |_. | ._._._. |_. | |_|_| | +| | . |_._| . ._._._| ._._. ._._| | | |_| . | |_. . ._|_| ._._. |_._|_| . | | +|_._|_._._._|_._._._|_|_._._._|_._|_._._._|_._._._|_._._._|_._._._._._._|_._| + +See Vim solve a maze! + + type ":so maze_mac<RETURN>" to load the macros + + type "g" to start + +to interrupt type "<CTRL-C>" + to quit type ":q!<RETURN>" + diff --git a/runtime/macros/maze/maze_5.78.info b/runtime/macros/maze/maze_5.78.info Binary files differnew file mode 100644 index 0000000..fd65cef --- /dev/null +++ b/runtime/macros/maze/maze_5.78.info diff --git a/runtime/macros/maze/maze_mac b/runtime/macros/maze/maze_mac new file mode 100644 index 0000000..621aeec --- /dev/null +++ b/runtime/macros/maze/maze_mac @@ -0,0 +1,271 @@ +" These macros 'solve' any maze produced by the a-maze-ing maze.c program. +" +" First, a bit of maze theory. +" If you were put into a maze, a guaranteed method of finding your way +" out of the maze is to put your left hand onto a wall and just keep walking, +" never taking your hand off the wall. This technique is only guaranteed to +" work if the maze does not have any 'islands', or if the 'exit' is on the +" same island as your starting point. These conditions hold for the mazes +" under consideration. +" +" Assuming that the maze is made up of horizontal and vertical walls spaced +" one step apart and that you can move either north, south, east or west, +" then you can automate this procedure by carrying out the following steps. +" +" 1. Put yourself somewhere in the maze near a wall. +" 2. Check if you have a wall on your left. If so, go to step 4. +" 3. There is no wall on your left, so turn on the spot to your left and step +" forward by one step and repeat step 2. +" 4. Check what is directly in front of you. If it is a wall, turn on the +" spot to your right by 90 degrees and repeat step 4. +" 5. There is no wall in front of you, so step forward one step and +" go to step 2. +" +" In this way you will cover all the corridors of the maze (until you get back +" to where you started from, if you do not stop). +" +" By examining a maze produced by the maze.c program you will see that +" each square of the maze is one character high and two characters wide. +" To go north or south, you move by a one character step, but to move east or +" west you move by a two character step. Also note that in any position +" there are four places where walls could be put - to the north, to the south, +" to the east and to the west. +" A wall exists to the north of you if the character to the north of +" you is a _ (otherwise it is a space). +" A wall exists to the east of you if the character to the east of you +" is a | (otherwise it is a .). +" A wall exists to the west of you if the character to the west of you +" is a | (otherwise it is a .). +" A wall exists to the south of you if the character where you are +" is a _ (otherwise it is a space). +" +" Note the difference for direction south, where we must examine the character +" where the cursor is rather than an adjacent cell. +" +" If you were implementing the above procedure is a normal computer language +" you could use a loop with if statements and continue statements, +" However, these constructs are not available in vi macros so I have used +" a state machine with 8 states. Each state signifies the direction you +" are going in and whether or not you have checked if there is a wall on +" your left. +" +" The transition from state to state and the actions taken on each transition +" are given in the state table below. +" The names of the states are N1, N2, S1, S2, E1, E2, W1, W2, where each letter +" stands for a direction of the compass, the number 1 indicates that the we +" have not yet checked to see if there is a wall on our left and the number 2 +" indicates that we have checked and there is a wall on our left. +" +" For each state we must consider the existence or not of a wall in a +" particular direction. This direction is given in the following table. +" +" NextChar table: +" state direction vi commands +" N1 W hF +" N2 N kF +" S1 E lF +" S2 S F +" E1 N kF +" E2 E lF +" W1 S F +" W2 W hF +" +" where F is a macro which yanks the character under the cursor into +" the NextChar register (n). +" +" State table: +" In the 'vi commands' column is given the actions to carry out when in +" this state and the NextChar is as given. The commands k, j, ll, hh move +" the current position north, south, east and west respectively. The +" command mm is used as a no-op command. +" In the 'next state' column is given the new state of the machine after +" the action is carried out. +" +" current state NextChar vi commands next state +" N1 . hh W1 +" N1 | mm N2 +" N2 _ mm E1 +" N2 space k N1 +" S1 . ll E1 +" S1 | mm S2 +" S2 _ mm W1 +" S2 space j S1 +" E1 space k N1 +" E1 _ mm E2 +" E2 | mm S1 +" E2 . ll E1 +" W1 space j S1 +" W1 _ mm W2 +" W2 | mm N1 +" W2 . hh W1 +" +" +" Complaint about vi macros: +" It seems that you cannot have more than one 'undo-able' vi command +" in the one macro, so you have to make lots of little macros and +" put them together. +" +" I'll explain what I mean by an example. Edit a file and +" type ':map Q rXY'. This should map the Q key to 'replace the +" character under the cursor with X and yank the line'. +" But when I type Q, vi tells me 'Can't yank inside global/macro' and +" goes into ex mode. However if I type ':map Q rXT' and ':map T Y', +" everything is OK. I`m doing all this on a Sparcstation. +" If anyone reading this has an answer to this problem, the author would +" love to find out. Mail to gregm@otc.otca.oz.au. +" +" The macros: +" The macro to run the maze solver is 'g'. This simply calls two other +" macros: I, to initialise everything, and L, to loop forever running +" through the state table. +" Both of these macros are long sequences of calls to other macros. All +" of these other macros are quite simple and so to understand how this +" works, all you need to do is examine macros I and L and learn what they +" do (a simple sequence of vi actions) and how L loops (by calling U, which +" simply calls L again). +" +" Macro I sets up the state table and NextChar table at the end of the file. +" Macro L then searches these tables to find out what actions to perform and +" what state changes to make. +" +" The entries in the state table all begin with a key consisting of the +" letter 's', the current state and the NextChar. After this is the +" action to take in this state and after this is the next state to change to. +" +" The entries in the NextChar table begin with a key consisting of the +" letter 'n' and the current state. After this is the action to take to +" obtain NextChar - the character that must be examined to change state. +" +" One way to see what each part of the macros is doing is to type in the +" body of the macros I and L manually (instead of typing 'g') and see +" what happens at each step. +" +" Good luck. +" +" Registers used by the macros: +" s (State) - holds the state the machine is in +" c (Char) - holds the character under the current position +" m (Macro) - holds a vi command string to be executed later +" n (NextChar) - holds the character we must examine to change state +" r (Second Macro) - holds a second vi command string to be executed later +" +set remap +set nomagic +set noterse +set wrapscan +" +"================================================================ +" g - go runs the whole show +" I - initialise +" L - then loop forever +map g IL +" +"================================================================ +" I - initialise everything before running the loop +" G$?.^M - find the last . in the maze +" ^ - replace it with an X (the goal) +" GYKeDP - print the state table and next char table at the end of the file +" 0S - initialise the state of the machine to E1 +" 2Gl - move to the top left cell of the maze +map I G$?.
^GYKeDP0S2Gl +" +"================================================================ +" L - the loop which is executed forever +" Q - save the current character in the Char register +" A - replace the current character with an 'O' +" ma - mark the current position with mark 'a' +" GNB - on bottom line, create a command to search the NextChar table +" for the current state +" 0M0E@m^M - yank the command into the Macro register and execute it +" wX - we have now found the entry in the table, now yank the +" following word into the Macro register +" `a@m - go back to the current position and execute the macro, this will +" yank the NextChar in register n +" GT$B$R - on bottom line, create a command to search the state table +" for the current state and NextChar +" 0M0E@m^M - yank the command into the Macro register and execute it +" 2WS - we have now found the entry in the table, now yank the +" next state into the State macro +" bX - and yank the action corresponding to this state table entry +" into the Macro register +" GVJ - on bottom line, create a command to restore the current character +" 0H - and save the command into the second Macro register +" `a@r - go back to the current position and exectute the macro to restore +" the current character +" @m - execute the action associated with this state +" U - and repeat +map L QAmaGNB0M0E@m
wX`a@mGT$B$R0M0E@m
2WSbXGVJ0H`a@r@mU +" +"================================================================ +" U - no tail recursion allowed in vi macros so cheat and set U = L +map U L +" +"================================================================ +" S - yank the next two characters into the State register +map S "sy2l +" +"================================================================ +" Q - save the current character in the Char register +map Q "cyl +" +"================================================================ +" A - replace the current character with an 'O' +map A rO +" +"================================================================ +" N - replace this line with the string 'n' +map N C/n +" +"================================================================ +" B - put the current state +map B "sp +" +"================================================================ +" M - yank this line into the Macro register +map M "my$ +" +"================================================================ +" E - delete to the end of the line +map E d$ +" +"================================================================ +" X - yank this word into the Macro register +map X "myt +" +"================================================================ +" T - replace this line with the string 's' +map T C/s +" +"================================================================ +" R - put NextChar +map R "np +" +"================================================================ +" V - add the letter 'r' (the replace vi command) +map V ar +" +"================================================================ +" J - restore the current character +map J "cp +" +"================================================================ +" H - yank this line into the second Macro register +map H "ry$ +" +"================================================================ +" F - yank NextChar (this macro is called from the Macro register) +map F "nyl +" +"================================================================ +" ^ - replace the current character with an 'X' +map ^ rX +" +"================================================================ +" YKeDP - create the state table, NextChar table and initial state +" Note that you have to escape the bar character, since it is special to +" the map command (it indicates a new line). +map Y osE1 k N1 sE1_ mm E2 sE2| mm S1 sE2. ll E1 +map K osW1 j S1 sW1_ mm W2 sW2| mm N1 sW2. hh W1 +map e osN1. hh W1 sN1| mm N2 sN2 k N1 sN2_ mm E1 +map D osS1. ll E1 sS1| mm S2 sS2 j S1 sS2_ mm W1 +map P onE1 kF nE2 lF nW1 G$JF nW2 hF nN1 hF nN2 kF nS1 lF nS2 G$JF
E1 diff --git a/runtime/macros/maze/mazeansi.c b/runtime/macros/maze/mazeansi.c new file mode 100644 index 0000000..b8e5e79 --- /dev/null +++ b/runtime/macros/maze/mazeansi.c @@ -0,0 +1,7 @@ +char*M,A,Z,E=40,J[80],T[3];main(C){for(M=J+E,*J=A=scanf("%d",& +C) ;-- E;J [E ]=M +[E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|" +) , A = 39 ,C -- +) ; Z || printf (T ))T[Z]=Z[A-(E =A[J-Z])&&!C +& A == M[ A] +|6<<27<rand()||!C&!Z?J[M[E]=M[A]]=E,J[M[A]=A-Z]=A,"_.":" |"];} diff --git a/runtime/macros/maze/mazeclean.c b/runtime/macros/maze/mazeclean.c new file mode 100644 index 0000000..04dcebd --- /dev/null +++ b/runtime/macros/maze/mazeclean.c @@ -0,0 +1,22 @@ +/* + * Cleaned-up version of the maze program. + * Doesn't look as nice, but should work with all C compilers. + * Sascha Wilde, October 2003 + */ +#include <stdio.h> +#include <stdlib.h> + +char *M, A, Z, E = 40, line[80], T[3]; +int +main (C) +{ + for (M = line + E, *line = A = scanf ("%d", &C); --E; line[E] = M[E] = E) + printf ("._"); + for (; (A -= Z = !Z) || (printf ("\n|"), A = 39, C--); Z || printf (T)) + T[Z] = Z[A - (E = A[line - Z]) && !C + & A == M[A] + | RAND_MAX/3 < rand () + || !C & !Z ? line[M[E] = M[A]] = E, line[M[A] = A - Z] = + A, "_." : " |"]; + return 0; +} diff --git a/runtime/macros/maze/poster b/runtime/macros/maze/poster new file mode 100644 index 0000000..9114f59 --- /dev/null +++ b/runtime/macros/maze/poster @@ -0,0 +1,37 @@ +Article 2846 of alt.sources: +Path: oce-rd1!hp4nl!mcsun!uunet!munnari.oz.au!metro!otc!gregm +From: gregm@otc.otca.oz.au (Greg McFarlane) +Newsgroups: alt.sources +Subject: VI SOLVES MAZE (commented macros) +Message-ID: <2289@otc.otca.oz> +Date: 10 Feb 91 23:31:02 GMT +Sender: news@otc.otca.oz +Reply-To: gregm@otc.otca.oz.au (Greg McFarlane) +Organization: OTC Development Unit, Australia +Lines: 464 + +Submitted-by: gregm@otc.otca.oz.au +Archive-name: maze_solving_vi_macros + +A real working model. See it walk the maze in front of your very own eyes. + +To prove that you can do anything in vi, I wrote a couple of macros that +allows vi to solve mazes. It will solve any maze produced by maze.c +that was posted to the alt.sources last month. (Maze.c is also included +in this posting as well as an example of its output.) + +The uncommented version of the macros was sent to alt.sources last month. +However, so many people mailed me requesting the commented version of the +macros that I decided to post it. I have made some modifications to the +original macros to make them easier to follow and also after I learnt +that you can escape the special meaning of '|' in macros by using '^V|'. + +Save this article and unshar it. Then read maze.README. + +After studying these macros, anyone who cannot write an emacs emulator +in vi macros should just curl up and :q!. + +Coming soon to a newsgroup near you: "Vi macros solve Tower of Hanoi", +and a repost of the original "Turing Machine implemented in Vi macros" + +Anyone who has a version of these macros for edlin or nroff, please post. diff --git a/runtime/macros/maze/poster.info b/runtime/macros/maze/poster.info Binary files differnew file mode 100644 index 0000000..9a478d6 --- /dev/null +++ b/runtime/macros/maze/poster.info diff --git a/runtime/macros/shellmenu.vim b/runtime/macros/shellmenu.vim new file mode 100644 index 0000000..4eb72a5 --- /dev/null +++ b/runtime/macros/shellmenu.vim @@ -0,0 +1,3 @@ +" Load the shellmenu package. +" For those users who were loading the shellmenu plugin from here. +packadd shellmenu diff --git a/runtime/macros/swapmous.vim b/runtime/macros/swapmous.vim new file mode 100644 index 0000000..5884d83 --- /dev/null +++ b/runtime/macros/swapmous.vim @@ -0,0 +1,3 @@ +" Load the swapmouse package. +" For those users who were loading the swapmous plugin from here. +packadd swapmouse diff --git a/runtime/macros/urm.info b/runtime/macros/urm.info Binary files differnew file mode 100644 index 0000000..65e8234 --- /dev/null +++ b/runtime/macros/urm.info diff --git a/runtime/macros/urm/README.txt b/runtime/macros/urm/README.txt new file mode 100644 index 0000000..a1ecc65 --- /dev/null +++ b/runtime/macros/urm/README.txt @@ -0,0 +1,47 @@ +This is another proof that Vim is perfectly compatible with Vi. +The URM macro package was written by Rudolf Koenig ("Rudi") +(rudolf@koeniglich.de) for hpux-vi in August 1991. + +Getting started: + +type +in your shell: vim urm<RETURN> +in vim: :so urm.vim<RETURN> +in vim: * (to load the registers and boot the URM-machine :-) +in vim: g (for 'go') and watch the fun. Per default, 3 and 4 + are multiplied. Watch the Program counter, it is + visible as a komma moving around. + +This is a "standard URM" (Universal register machine) interpreter. The URM +concept is used in theoretical computer science to aid in theorem proving. +Here it proves that vim is a general problem solver (if you bring enough +patience). + +The interpreter begins with register 1 (not 0), without macros and more-lines +capability. A dot marks the end of a program. (Bug: there must be a space +after the dot.) + +The registers are the first few lines, beginning with a '>' . +The program is the first line after the registers. +You should always initialize the registers required by the program. + +Output register: line 2 +Input registers: line 2 to ... + +Commands: +a<n> increment register <n> +s<n> decrement register <n> +<x>;<y> execute command <x> and then <y> +(<x>)<n> execute command <x> while register <n> is nonzero +. ("dot blank") halt the machine. + +Examples: + +Add register 2 to register 3: + (a2;s3)3. +Multiply register 2 with register 3: + (a4;a5;s2)2; ((a2;s4)4; s3; (a1;a4;s5)5; (a5;s1)1)3. + +There are more (complicated) examples in the file examples. +Note, undo may take a while after a division. + diff --git a/runtime/macros/urm/README.txt.info b/runtime/macros/urm/README.txt.info Binary files differnew file mode 100644 index 0000000..1337937 --- /dev/null +++ b/runtime/macros/urm/README.txt.info diff --git a/runtime/macros/urm/examples b/runtime/macros/urm/examples new file mode 100644 index 0000000..9907d4a --- /dev/null +++ b/runtime/macros/urm/examples @@ -0,0 +1,16 @@ +Note that enough temporary registers should be provided for each example. +All should be initialised to 0. + +Initial register values for benchmarking: 0,8,3,0,... + +Performed on a Xenix 386/16: +Operation [sec, kbyte tmp space]: program + +Asym. Diff.[ 7, 4]: (s2;s3)3. +Abs. Diff. [90,81]: (a1;a4;s2)2; (a2;s1)1; (a1;a5;s3)3; (a3;s1)1; (s2;s3)3; (s5;s4)4; (a2;s5)5. +Add [ 7, 4]: (a2;s3)3. +Mult [227, 161]: (a4;a5;s2)2; ((a2;s4)4; s3; (a1;a4;s5)5; (a5;s1)1)3. +Copy [ 48, 25]: (a1;a3;s2)2; (a2;s1)1. +sign [ 30, 17]: (a3;s2)2; (a2;(s3)3)3. +!sign[ 36, 28]: (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3. +Div [630,1522]: (a9;s2)2; (a2;a10;s3)3; (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3; (a2)2;(a2;s9)9;(a3;s10)10; (a9;a10;s2)2; (a11;a12;s3)3; (a2;s12)12; (a3;s9)9; (s2;s3)3; (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3; (a1;s2)2; (a2;s10)10; (a3;s11)11; ((a12;a13;s3)3; (a3;s13)13; (s2;s3)3; (a3;s12)12; a14; (s1)1; (a9;a10;s2)2; (a11;a12;s3)3; (a2;s12)12; (a3;s9)9; (s2;s3)3; (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3; (a1;s2)2; (a2;s10)10; (a3;s11)11)1; (s2)2; (a2;s14)14. diff --git a/runtime/macros/urm/urm b/runtime/macros/urm/urm new file mode 100644 index 0000000..9cbefb7 --- /dev/null +++ b/runtime/macros/urm/urm @@ -0,0 +1,22 @@ +>0 +>3 +>4 +>0 +>0 +>0 +(a4;a5;s2)2; ((a2;s4)4; s3; (a1;a4;s5)5; (a5;s1)1)3. +_________ +O ; =xp ( =x%hp ) @l a @db s @dt . =x0xkdd:ready _end_ +o 0 1 2 3 4 5 6 7 8 9 0 +_________ +INIT main(k), l, b, c, t, u, q, d +
"kT
"lT
"bT
"cT
"tT
"uT
"qT
"dT +=lF'wa/O
fpaw"zdt hp@z0"xD@x@k +=2ldwhp'wiGT'wp0P0"yD@ya =xlwP >0 =x%p I k/>0
ww"ydt 0D@y +'wa/o
fwF'wpi`ar`aF'wffp0"vD@v0"vDp03x@v'wa @c 0 0 0I f0w"wdt 0D@w +`ahmaF'wa 'aa1 > @b 0p0f>w"vdt 0D@v +'wa/o
wfbF'wpi`ar`aF'wffp0"vD@v0"vDp03x@v'wa @u 9 0 0I f9w"wdt 0D@w +`ahmaF'wa `alr0 > @q 0p0f>w"vdt 0D@v +`ahy2l'wa `ax >1 @t 0p0/>1
ww"idt 0D@i +=xwhpbldwhp'wpaG$ma0"yD@y@ + diff --git a/runtime/macros/urm/urm.vim b/runtime/macros/urm/urm.vim new file mode 100644 index 0000000..3108180 --- /dev/null +++ b/runtime/macros/urm/urm.vim @@ -0,0 +1,5 @@ +map * 1G/INIT
j"iT@i1G/INIT
dG +map g 1G/^[(as;.]
i
>,mkkmw@k +map T y$ +map F yl +map = 'kf, |