From 8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 04:44:24 +0200 Subject: Adding upstream version 2:8.1.0875. Signed-off-by: Daniel Baumann --- runtime/macros/README.txt | 33 +++++ runtime/macros/README.txt.info | Bin 0 -> 734 bytes runtime/macros/editexisting.vim | 3 + runtime/macros/hanoi.info | Bin 0 -> 624 bytes runtime/macros/hanoi/click.me | 14 ++ runtime/macros/hanoi/click.me.info | Bin 0 -> 973 bytes runtime/macros/hanoi/hanoi.vim | 64 ++++++++ runtime/macros/hanoi/poster | 36 +++++ runtime/macros/hanoi/poster.info | Bin 0 -> 735 bytes runtime/macros/justify.vim | 3 + runtime/macros/less.bat | 10 ++ runtime/macros/less.sh | 26 ++++ runtime/macros/less.vim | 284 ++++++++++++++++++++++++++++++++++++ runtime/macros/life/click.me | 9 ++ runtime/macros/life/click.me.info | Bin 0 -> 972 bytes runtime/macros/life/life.vim | 261 +++++++++++++++++++++++++++++++++ runtime/macros/matchit.vim | 5 + runtime/macros/maze.info | Bin 0 -> 624 bytes runtime/macros/maze/Makefile | 7 + runtime/macros/maze/README.txt | 49 +++++++ runtime/macros/maze/README.txt.info | Bin 0 -> 734 bytes runtime/macros/maze/maze.c | 7 + runtime/macros/maze/maze_5.78 | 16 ++ runtime/macros/maze/maze_5.78.info | Bin 0 -> 972 bytes runtime/macros/maze/maze_mac | 271 ++++++++++++++++++++++++++++++++++ runtime/macros/maze/mazeansi.c | 7 + runtime/macros/maze/mazeclean.c | 22 +++ runtime/macros/maze/poster | 37 +++++ runtime/macros/maze/poster.info | Bin 0 -> 734 bytes runtime/macros/shellmenu.vim | 3 + runtime/macros/swapmous.vim | 3 + runtime/macros/urm.info | Bin 0 -> 624 bytes runtime/macros/urm/README.txt | 47 ++++++ runtime/macros/urm/README.txt.info | Bin 0 -> 734 bytes runtime/macros/urm/examples | 16 ++ runtime/macros/urm/urm | 22 +++ runtime/macros/urm/urm.vim | 5 + 37 files changed, 1260 insertions(+) create mode 100644 runtime/macros/README.txt create mode 100644 runtime/macros/README.txt.info create mode 100644 runtime/macros/editexisting.vim create mode 100644 runtime/macros/hanoi.info create mode 100644 runtime/macros/hanoi/click.me create mode 100644 runtime/macros/hanoi/click.me.info create mode 100644 runtime/macros/hanoi/hanoi.vim create mode 100644 runtime/macros/hanoi/poster create mode 100644 runtime/macros/hanoi/poster.info create mode 100644 runtime/macros/justify.vim create mode 100644 runtime/macros/less.bat create mode 100755 runtime/macros/less.sh create mode 100644 runtime/macros/less.vim create mode 100644 runtime/macros/life/click.me create mode 100644 runtime/macros/life/click.me.info create mode 100644 runtime/macros/life/life.vim create mode 100644 runtime/macros/matchit.vim create mode 100644 runtime/macros/maze.info create mode 100644 runtime/macros/maze/Makefile create mode 100644 runtime/macros/maze/README.txt create mode 100644 runtime/macros/maze/README.txt.info create mode 100644 runtime/macros/maze/maze.c create mode 100644 runtime/macros/maze/maze_5.78 create mode 100644 runtime/macros/maze/maze_5.78.info create mode 100644 runtime/macros/maze/maze_mac create mode 100644 runtime/macros/maze/mazeansi.c create mode 100644 runtime/macros/maze/mazeclean.c create mode 100644 runtime/macros/maze/poster create mode 100644 runtime/macros/maze/poster.info create mode 100644 runtime/macros/shellmenu.vim create mode 100644 runtime/macros/swapmous.vim create mode 100644 runtime/macros/urm.info create mode 100644 runtime/macros/urm/README.txt create mode 100644 runtime/macros/urm/README.txt.info create mode 100644 runtime/macros/urm/examples create mode 100644 runtime/macros/urm/urm create mode 100644 runtime/macros/urm/urm.vim (limited to 'runtime/macros') 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 new file mode 100644 index 0000000..d173e72 Binary files /dev/null and b/runtime/macros/README.txt.info differ 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 new file mode 100644 index 0000000..8072e56 Binary files /dev/null and b/runtime/macros/hanoi.info differ 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" to load the macros + type "g" to start it + +and watch it go. + + to quit type ":q!" +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 new file mode 100644 index 0000000..f38cb5a Binary files /dev/null and b/runtime/macros/hanoi/click.me.info differ 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 new file mode 100644 index 0000000..780fa35 Binary files /dev/null and b/runtime/macros/hanoi/poster.info differ 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..53857c6 --- /dev/null +++ b/runtime/macros/less.vim @@ -0,0 +1,284 @@ +" Vim script to work like "less" +" Maintainer: Bram Moolenaar +" Last Change: 2017 Mar 31 + +" 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 + +set nocp +syntax on +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 L L0:redraw:file + au VimEnter * normal! L0 +else + noremap L Lg0:redraw:file + au VimEnter * normal! Lg0 +endif + +" When reading from stdin don't consider the file modified. +au VimEnter * set nomod + +" Can't modify the text +set noma + +" Give help +noremap h :call Help() +map H h +fun! s:Help() + echo " One page forward b One page backward" + echo "d Half a page forward u Half a page backward" + echo " 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 Next file :p Previous file" + echo "\n" + echo "q Quit v Edit file" + let i = input("Hit Enter to continue") +endfun + +" Scroll one page forward +noremap