├── .builds ├── alpine.yml ├── debian.yml ├── freebsd.yml └── openbsd.yml ├── .codecov.yml ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml └── workflows │ ├── coverity-scan.yml │ ├── luacheck.yml │ ├── luadoc.yml │ ├── macos.yml │ ├── man.yml │ ├── ubuntu.yml │ └── windows.yml.NOACTIVE ├── .gitignore ├── .luacheckrc ├── CHANGELOG.md ├── Dockerfile ├── GNUmakefile ├── LICENSE ├── Makefile ├── README.md ├── array.c ├── array.h ├── buffer.c ├── buffer.h ├── config.def.h ├── configure ├── doc ├── .gitignore ├── Doxyfile ├── Makefile ├── array.rst ├── buffer.rst ├── conf.py ├── index.rst ├── map.rst ├── requirements.txt ├── text.rst ├── view.rst └── vis.rst ├── event-basic.c ├── libutf.c ├── libutf.h ├── lua ├── doc │ ├── README.md │ └── config.ld ├── lexer.lua ├── lexers │ ├── LICENSE │ ├── README.md │ ├── actionscript.lua │ ├── ada.lua │ ├── antlr.lua │ ├── apdl.lua │ ├── apl.lua │ ├── applescript.lua │ ├── asm.lua │ ├── asp.lua │ ├── autohotkey.lua │ ├── autoit.lua │ ├── awk.lua │ ├── bash.lua │ ├── batch.lua │ ├── bibtex.lua │ ├── boo.lua │ ├── c.lua │ ├── caml.lua │ ├── chuck.lua │ ├── clojure.lua │ ├── cmake.lua │ ├── coffeescript.lua │ ├── container.lua │ ├── context.lua │ ├── cpp.lua │ ├── crystal.lua │ ├── csharp.lua │ ├── css.lua │ ├── cuda.lua │ ├── d.lua │ ├── dart.lua │ ├── desktop.lua │ ├── diff.lua │ ├── django.lua │ ├── dockerfile.lua │ ├── dot.lua │ ├── dsv.lua │ ├── eiffel.lua │ ├── elixir.lua │ ├── elm.lua │ ├── erlang.lua │ ├── factor.lua │ ├── fantom.lua │ ├── faust.lua │ ├── fennel.lua │ ├── fish.lua │ ├── forth.lua │ ├── fortran.lua │ ├── fsharp.lua │ ├── fstab.lua │ ├── gap.lua │ ├── gemini.lua │ ├── gettext.lua │ ├── gherkin.lua │ ├── git-rebase.lua │ ├── gleam.lua │ ├── glsl.lua │ ├── gnuplot.lua │ ├── go.lua │ ├── groovy.lua │ ├── gtkrc.lua │ ├── hare.lua │ ├── haskell.lua │ ├── html.lua │ ├── icon.lua │ ├── idl.lua │ ├── inform.lua │ ├── ini.lua │ ├── io_lang.lua │ ├── java.lua │ ├── javascript.lua │ ├── jq.lua │ ├── json.lua │ ├── jsp.lua │ ├── julia.lua │ ├── latex.lua │ ├── ledger.lua │ ├── less.lua │ ├── lexer.lua │ ├── lilypond.lua │ ├── lisp.lua │ ├── litcoffee.lua │ ├── logtalk.lua │ ├── lua.lua │ ├── makefile.lua │ ├── man.lua │ ├── markdown.lua │ ├── matlab.lua │ ├── mediawiki.lua │ ├── meson.lua │ ├── moonscript.lua │ ├── myrddin.lua │ ├── nemerle.lua │ ├── networkd.lua │ ├── nim.lua │ ├── nix.lua │ ├── nsis.lua │ ├── null.lua │ ├── objeck.lua │ ├── objective_c.lua │ ├── org.lua │ ├── output.lua │ ├── pascal.lua │ ├── perl.lua │ ├── php.lua │ ├── pico8.lua │ ├── pike.lua │ ├── pkgbuild.lua │ ├── pony.lua │ ├── powershell.lua │ ├── prolog.lua │ ├── props.lua │ ├── protobuf.lua │ ├── ps.lua │ ├── pure.lua │ ├── python.lua │ ├── r.lua │ ├── rails.lua │ ├── rc.lua │ ├── reason.lua │ ├── rebol.lua │ ├── rest.lua │ ├── rexx.lua │ ├── rhtml.lua │ ├── routeros.lua │ ├── rpmspec.lua │ ├── ruby.lua │ ├── rust.lua │ ├── sass.lua │ ├── scala.lua │ ├── scheme.lua │ ├── smalltalk.lua │ ├── sml.lua │ ├── snobol4.lua │ ├── spin.lua │ ├── sql.lua │ ├── strace.lua │ ├── systemd.lua │ ├── taskpaper.lua │ ├── tcl.lua │ ├── template.txt │ ├── tex.lua │ ├── texinfo.lua │ ├── text.lua │ ├── toml.lua │ ├── troff.lua │ ├── txt2tags.lua │ ├── typescript.lua │ ├── vala.lua │ ├── vb.lua │ ├── vcard.lua │ ├── verilog.lua │ ├── vhdl.lua │ ├── wsf.lua │ ├── xml.lua │ ├── xs.lua │ ├── xtend.lua │ ├── yaml.lua │ └── zig.lua ├── plugins │ ├── complete-filename.lua │ ├── complete-word.lua │ ├── digraph.lua │ ├── filetype.lua │ ├── number-inc-dec.lua │ └── textobject-lexer.lua ├── themes │ ├── base-16.lua │ ├── default.lua │ ├── solarized.lua │ └── zenburn.lua ├── vis-std.lua ├── vis.lua └── visrc.lua ├── main.c ├── man ├── vis-clipboard.1 ├── vis-complete.1 ├── vis-digraph.1 ├── vis-menu.1 ├── vis-open.1 └── vis.1 ├── map.c ├── map.h ├── sam.c ├── sam.h ├── test ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── core │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── array-test.c │ ├── buffer-test.c │ ├── ccan-config.c │ ├── ccan │ │ ├── compiler │ │ │ ├── LICENSE │ │ │ ├── _info │ │ │ ├── compiler.h │ │ │ └── test │ │ │ │ ├── compile_fail-printf.c │ │ │ │ └── run-is_compile_constant.c │ │ └── tap │ │ │ ├── _info │ │ │ ├── tap.3 │ │ │ ├── tap.c │ │ │ ├── tap.h │ │ │ └── test │ │ │ └── run.c │ ├── licenses │ │ └── CC0 │ ├── map-test.c │ ├── tap.h │ └── text-test.c ├── fuzz │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── buffer-fuzzer.c │ ├── dictionaries │ │ ├── buffer-fuzzer.dict │ │ ├── text-fuzzer.dict │ │ └── text-libfuzzer.dict │ ├── fuzzer.h │ ├── inputs │ │ ├── buffer-fuzzer │ │ │ └── buffer-fuzzer.in │ │ ├── text-fuzzer │ │ │ └── text-fuzzer.in │ │ └── text-libfuzzer │ │ │ └── text-libfuzzer.in │ └── text-fuzzer.c ├── lua │ ├── Makefile │ ├── README.md │ ├── cursor.in │ ├── cursor.lua │ ├── file-empty.in │ ├── file-empty.lua │ ├── lines.in │ ├── lines.lua │ ├── map-basic.lua │ ├── pipe.in │ ├── pipe.lua │ ├── test.sh │ └── visrc.lua ├── sam │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── addresses │ │ ├── columns.cmd │ │ ├── columns.in │ │ ├── first-last.cmd │ │ ├── first-last.in │ │ ├── lines.cmd │ │ ├── lines.in │ │ ├── second.cmd │ │ └── second.in │ ├── commands │ │ ├── filter-capitalize.cmd │ │ ├── filter-capitalize.in │ │ ├── group.cmd │ │ ├── group.in │ │ ├── long-text.cmd │ │ ├── long-text.in │ │ ├── loop-empty-match1.cmd │ │ ├── loop-empty-match1.in │ │ ├── loop-empty-match2.cmd │ │ ├── loop-empty-match2.in │ │ ├── loop-empty-match3.cmd │ │ ├── loop-empty-match3.in │ │ ├── loop-empty-match4.cmd │ │ ├── loop-empty-match4.in │ │ ├── loop-lines.in │ │ ├── loop-lines1.cmd │ │ ├── loop-lines1.in │ │ ├── loop-lines2.cmd │ │ ├── loop-lines2.in │ │ ├── loop-lines3.cmd │ │ ├── loop-lines3.in │ │ ├── loop-lines4.cmd │ │ ├── loop-lines4.in │ │ ├── loop-lines5.cmd │ │ ├── loop-lines5.in │ │ ├── loop-lines6.cmd │ │ ├── loop-lines6.in │ │ ├── loop-lines7.cmd │ │ ├── loop-lines7.in │ │ ├── loop-lines8.cmd │ │ ├── loop-lines8.in │ │ ├── loop-lines9.cmd │ │ ├── loop-lines9.in │ │ ├── pipe-in.cmd │ │ ├── pipe-in.in │ │ ├── pipe-out.cmd │ │ ├── pipe-out.in │ │ ├── repeated-shell.cmd │ │ ├── repeated-shell.in │ │ ├── unicode-replace.cmd │ │ └── unicode-replace.in │ ├── errors │ │ ├── conflict.cmd │ │ ├── conflict.in │ │ ├── read.cmd │ │ ├── read.in │ │ ├── unbalanced-group.cmd │ │ └── unbalanced-group.in │ ├── examples │ │ ├── comment-functions.cmd │ │ ├── comment-functions.in │ │ ├── delete-empty-lines.cmd │ │ ├── delete-empty-lines.in │ │ ├── swap-words.cmd │ │ └── swap-words.in │ ├── test.sh │ └── visrc.lua ├── util │ ├── .gitignore │ ├── Makefile │ ├── README.md │ └── keys.c ├── vim │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── golf │ │ ├── 4d1a34ccfa85f32065000004 │ │ │ ├── 1.in │ │ │ ├── 1.keys │ │ │ └── 1.ref │ │ ├── 4d1ac1800a045132c0000011 │ │ │ ├── 1.in │ │ │ ├── 1.keys │ │ │ └── 1.ref │ │ ├── 4d665abd7d73e02a55000009 │ │ │ ├── 1.in │ │ │ ├── 1.keys.broken │ │ │ └── 1.ref │ │ ├── 4ddbd92898957e0001000016 │ │ │ ├── 1.in │ │ │ ├── 1.keys │ │ │ └── 1.ref │ │ ├── 4e31627b74ab580001000007 │ │ │ ├── 1.disabled │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 4ef209ef78702b0001000019 │ │ │ ├── 1.in │ │ │ ├── 1.keys │ │ │ └── 1.ref │ │ ├── 4fbf8e303be58b0001000024 │ │ │ ├── 1.in │ │ │ ├── 1.keys │ │ │ └── 1.ref │ │ ├── 50ad2cb165b8db0002000029 │ │ │ ├── 1.in │ │ │ ├── 1.keys │ │ │ └── 1.ref │ │ ├── 50b1d7239aad89000200002d │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 50c13afab855760002000049 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 50c18a08b855760002000056 │ │ │ ├── 1.in │ │ │ ├── 1.keys.broken │ │ │ └── 1.ref │ │ ├── 50c2c246b0544c000200003f │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 50d0c33daa503f000200000f │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 50ee7504c0e3aa0002000040 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 51103ad8041832000200003f │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 5192f96ad8df110002000002 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 524e1a20b81fe50002000008 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 52c3cb0d9b8634000200000e │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 53369b712a09c1000223fb57 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 536cfa23fcccd100025678bd │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 537a553282aa3e000222048a │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 53d93fc3768e280002124f23 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 54595b13128576000257a3c1 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 5462e3f41198b80002512673 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 54698da795f6da00020d85ed │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 54862fbb3f90ac0002904cf5 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 55771cc4750ef86573003b83 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 559c30948ef59c0eb7000002 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 55b18bbea9c2c30d04000001 │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ ├── 55bcdc3ef4219f456102374f │ │ │ ├── 1.in │ │ │ └── 1.ref │ │ └── 55f9720b4a665c2acf0008c8 │ │ │ ├── 1.in │ │ │ └── 1.ref │ ├── motions │ │ ├── goto.in │ │ └── goto.keys │ ├── operators │ │ ├── change │ │ │ ├── change.in │ │ │ └── change.keys │ │ ├── delete │ │ │ ├── delete.in │ │ │ └── delete.keys │ │ ├── insert │ │ │ ├── append.in │ │ │ ├── append.keys │ │ │ ├── insert.in │ │ │ └── insert.keys │ │ ├── join │ │ │ ├── count.in │ │ │ ├── count.keys │ │ │ ├── empty.in │ │ │ ├── empty.keys │ │ │ ├── visual-line.in │ │ │ ├── visual-line.keys │ │ │ ├── visual.in │ │ │ ├── visual.keys │ │ │ ├── whitespace.in │ │ │ └── whitespace.keys │ │ ├── openline │ │ │ ├── openline.in │ │ │ └── openline.keys │ │ ├── put │ │ │ ├── put.in │ │ │ ├── put.keys │ │ │ ├── visual.in │ │ │ └── visual.keys │ │ ├── replace │ │ │ ├── replace.in │ │ │ └── replace.keys │ │ ├── shift │ │ │ ├── shift.in │ │ │ └── shift.keys │ │ └── yank │ │ │ ├── yank.in │ │ │ └── yank.keys │ ├── registers │ │ ├── black-hole.in │ │ ├── black-hole.keys │ │ ├── command.in │ │ ├── command.keys │ │ ├── named.in │ │ ├── named.keys │ │ ├── search.in │ │ ├── search.keys │ │ ├── zero.in │ │ └── zero.keys │ ├── special-files │ │ ├── combining.in │ │ ├── combining.keys │ │ ├── mmap.in │ │ ├── mmap.keys │ │ ├── search-binary.in │ │ └── search-binary.keys │ ├── test.sh │ ├── text-objects │ │ ├── braces-count-linewise.in │ │ ├── braces-count-linewise.keys │ │ ├── words-count.in │ │ ├── words-count.keys │ │ ├── words-eol.in │ │ ├── words-eol.keys │ │ ├── words-symbols.in │ │ └── words-symbols.keys │ └── visrc.lua └── vis │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── errors │ ├── filter.in │ ├── filter.keys │ ├── filter.ref │ ├── pipe-in.in │ ├── pipe-in.keys │ └── pipe-in.ref │ ├── insert-mode │ ├── autoindent.in │ ├── autoindent.keys │ ├── autoindent.ref │ ├── digraph.in │ ├── digraph.keys │ ├── digraph.ref │ ├── verbatim.in │ ├── verbatim.keys │ └── verbatim.ref │ ├── interop │ ├── pre-save-grows.in │ ├── pre-save-grows.keys │ ├── pre-save-grows.lua │ ├── pre-save-grows.ref │ ├── pre-save-shrinks.in │ ├── pre-save-shrinks.keys │ ├── pre-save-shrinks.lua │ └── pre-save-shrinks.ref │ ├── mappings │ ├── insert-mode.in │ ├── insert-mode.keys │ └── insert-mode.ref │ ├── motions │ ├── line-begin.in │ ├── line-begin.keys │ ├── line-begin.ref │ ├── line-char-first.in │ ├── line-char-first.keys │ ├── line-char-first.ref │ ├── line-char-last.in │ ├── line-char-last.keys │ ├── line-char-last.ref │ ├── line-end.in │ ├── line-end.keys │ ├── line-end.ref │ ├── next-end-of-bigword.in │ ├── next-end-of-bigword.keys │ ├── next-end-of-bigword.ref │ ├── next-end-of-word.in │ ├── next-end-of-word.keys │ ├── next-end-of-word.ref │ ├── next-start-of-bigword.in │ ├── next-start-of-bigword.keys │ ├── next-start-of-bigword.ref │ ├── next-start-of-word.in │ ├── next-start-of-word.keys │ ├── next-start-of-word.ref │ ├── percent.in │ ├── percent.keys │ ├── percent.ref │ ├── prev-end-of-bigword.in │ ├── prev-end-of-bigword.keys │ ├── prev-end-of-bigword.ref │ ├── prev-end-of-word.in │ ├── prev-end-of-word.keys │ ├── prev-end-of-word.ref │ ├── prev-start-of-bigword.in │ ├── prev-start-of-bigword.keys │ ├── prev-start-of-bigword.ref │ ├── prev-start-of-word.in │ ├── prev-start-of-word.keys │ ├── prev-start-of-word.ref │ ├── till-left.in │ ├── till-left.keys │ ├── till-left.ref │ ├── till-right.in │ ├── till-right.keys │ ├── till-right.ref │ ├── to-left.in │ ├── to-left.keys │ ├── to-left.ref │ ├── to-right.in │ ├── to-right.keys │ └── to-right.ref │ ├── prompt │ ├── history.in │ ├── history.keys │ └── history.ref │ ├── selections │ ├── align-indent-columns.in │ ├── align-indent-columns.keys │ ├── align-indent-columns.ref │ ├── align-indent.in │ ├── align-indent.keys │ ├── align-indent.ref │ ├── align.in │ ├── align.keys │ ├── align.ref │ ├── complement-whole.in │ ├── complement-whole.keys │ ├── complement-whole.ref │ ├── complement.in │ ├── complement.keys │ ├── complement.ref │ ├── end-of-file.in │ ├── end-of-file.keys │ ├── end-of-file.ref │ ├── intersect-adjacent.in │ ├── intersect-adjacent.keys │ ├── intersect-adjacent.ref │ ├── intersect-contained.in │ ├── intersect-contained.keys │ ├── intersect-contained.ref │ ├── intersect-empty.in │ ├── intersect-empty.keys │ ├── intersect-empty.ref │ ├── intersect-overlapping.in │ ├── intersect-overlapping.keys │ ├── intersect-overlapping.ref │ ├── intersect-whole.in │ ├── intersect-whole.keys │ ├── intersect-whole.ref │ ├── minus-adjacent.in │ ├── minus-adjacent.keys │ ├── minus-adjacent.ref │ ├── minus-contained.in │ ├── minus-contained.keys │ ├── minus-contained.ref │ ├── minus-empty.in │ ├── minus-empty.keys │ ├── minus-empty.ref │ ├── minus-overlapping.in │ ├── minus-overlapping.keys │ ├── minus-overlapping.ref │ ├── minus-whole.in │ ├── minus-whole.keys │ ├── minus-whole.ref │ ├── new-above-first-below-last.in │ ├── new-above-first-below-last.keys │ ├── new-above-first-below-last.ref │ ├── new-below-above.in │ ├── new-below-above.keys │ ├── new-below-above.ref │ ├── new-end-of-line.in │ ├── new-end-of-line.keys │ ├── new-end-of-line.ref │ ├── new-start-of-line.in │ ├── new-start-of-line.keys │ ├── new-start-of-line.ref │ ├── normal-mode-wq.in │ ├── normal-mode-wq.keys │ ├── normal-mode-wq.ref │ ├── odd-even.in │ ├── odd-even.keys │ ├── odd-even.ref │ ├── out-of-view.in.disabled │ ├── out-of-view.keys │ ├── out-of-view.ref │ ├── remove-column.in │ ├── remove-column.keys │ ├── remove-column.ref │ ├── select-match.in │ ├── select-match.keys │ ├── select-match.ref │ ├── selections-rotate.in │ ├── selections-rotate.keys │ ├── selections-rotate.ref │ ├── selections-trim.in │ ├── selections-trim.keys │ ├── selections-trim.ref │ ├── union-adjacent.in │ ├── union-adjacent.keys │ ├── union-adjacent.ref │ ├── union-contained.in │ ├── union-contained.keys │ ├── union-contained.ref │ ├── union-empty.in │ ├── union-empty.keys │ ├── union-empty.ref │ ├── union-overlapping.in │ ├── union-overlapping.keys │ ├── union-overlapping.ref │ ├── union-whole.in │ ├── union-whole.keys │ └── union-whole.ref │ ├── structural-regex │ └── addresses │ │ ├── marks.in │ │ ├── marks.keys │ │ ├── marks.ref │ │ ├── round-down.in │ │ ├── round-down.keys │ │ ├── round-down.ref │ │ ├── round-up.in │ │ ├── round-up.keys │ │ └── round-up.ref │ ├── test.sh │ ├── text-objects │ ├── indentation.in │ ├── indentation.keys │ ├── indentation.ref │ ├── lexer.in │ ├── lexer.keys │ ├── lexer.ref │ ├── line.in │ ├── line.keys │ ├── line.ref │ ├── search-result.in │ ├── search-result.keys │ └── search-result.ref │ ├── visrc.lua │ └── visual-mode │ ├── orientation.in │ ├── orientation.keys │ └── orientation.ref ├── text-common.c ├── text-internal.h ├── text-io.c ├── text-iterator.c ├── text-motions.c ├── text-motions.h ├── text-objects.c ├── text-objects.h ├── text-regex-tre.c ├── text-regex.c ├── text-regex.h ├── text-util.c ├── text-util.h ├── text.c ├── text.h ├── ui-terminal-curses.c ├── ui-terminal-vt100.c ├── ui-terminal.c ├── ui.h ├── util.h ├── view.c ├── view.h ├── vis-clipboard ├── vis-cmds.c ├── vis-complete ├── vis-core.h ├── vis-digraph.c ├── vis-lua.c ├── vis-lua.h ├── vis-marks.c ├── vis-menu.c ├── vis-modes.c ├── vis-motions.c ├── vis-open ├── vis-operators.c ├── vis-prompt.c ├── vis-registers.c ├── vis-single.c ├── vis-subprocess.c ├── vis-subprocess.h ├── vis-text-objects.c ├── vis.c └── vis.h /.builds/alpine.yml: -------------------------------------------------------------------------------- 1 | image: alpine/edge 2 | packages: 3 | - acl-dev 4 | - libtermkey-dev 5 | - lua5.3-dev 6 | - lua5.3-lpeg 7 | - ncurses-dev 8 | - ncurses-terminfo 9 | sources: 10 | - https://github.com/martanne/vis 11 | tasks: 12 | - build: | 13 | cd vis 14 | ./configure 15 | make 16 | - test: | 17 | cd vis 18 | make test 19 | -------------------------------------------------------------------------------- /.builds/debian.yml: -------------------------------------------------------------------------------- 1 | image: debian/stable 2 | packages: 3 | - libacl1-dev 4 | - liblua5.3-dev 5 | - libncursesw5-dev 6 | - libselinux1-dev 7 | - libtermkey-dev 8 | - libtre-dev 9 | - lua-lpeg 10 | sources: 11 | - https://github.com/martanne/vis 12 | tasks: 13 | - locale: | 14 | sudo sh -c 'echo en_US.UTF-8 UTF-8 > /etc/locale.gen' 15 | sudo locale-gen 16 | - build: | 17 | cd vis 18 | ./configure 19 | make 20 | - test: | 21 | cd vis 22 | make test 23 | -------------------------------------------------------------------------------- /.builds/freebsd.yml: -------------------------------------------------------------------------------- 1 | image: freebsd/latest 2 | packages: 3 | - gmake 4 | - libtermkey 5 | - lua53 6 | - lua53-lpeg 7 | - pkgconf 8 | sources: 9 | - https://github.com/martanne/vis 10 | tasks: 11 | - build: | 12 | cd vis 13 | ./configure 14 | make 15 | - test: | 16 | cd vis 17 | gmake test 18 | -------------------------------------------------------------------------------- /.builds/openbsd.yml: -------------------------------------------------------------------------------- 1 | image: openbsd/latest 2 | packages: 3 | - gmake 4 | - libtermkey 5 | - lua%5.3 6 | - lua53-lpeg 7 | sources: 8 | - https://github.com/martanne/vis 9 | tasks: 10 | - build: | 11 | cd vis 12 | ./configure 13 | make 14 | - test: | 15 | cd vis 16 | gmake test 17 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "dependency" 3 | - "test" 4 | 5 | comment: off 6 | 7 | coverage: 8 | status: 9 | project: off 10 | patch: off 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | indent_style = tab 8 | 9 | [*.md] 10 | indent_size = 4 11 | indent_style = space 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | labels: [] 3 | description: Report a problem with vis. 4 | body: 5 | 6 | - type: markdown 7 | attributes: 8 | value: | 9 | ***Before reporting***, search [existing issues.](https://github.com/martanne/vis/issues?q=type%3Aissue) 10 | 11 | - type: textarea 12 | attributes: 13 | label: "Problem" 14 | description: "Describe the current behavior." 15 | validations: 16 | required: true 17 | - type: textarea 18 | attributes: 19 | label: "Steps to reproduce" 20 | placeholder: | 21 | :, 22 | :y/regex/ 23 | - type: input 24 | attributes: 25 | label: "vis version (vis -v)" 26 | placeholder: "vis v0.7-151-g8ff0bea-dirty +curses +lua +tre +acl" 27 | validations: 28 | required: true 29 | - type: input 30 | attributes: 31 | label: "Terminal name/version" 32 | placeholder: "st 0.8.2" 33 | - type: input 34 | attributes: 35 | label: "$TERM environment variable" 36 | placeholder: "st-256color" 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: IRC Channel 4 | url: https://web.libera.chat/#vis-editor 5 | about: "Join the IRC channel #vis-editor on libera." 6 | - name: Mailing List 7 | url: https://lists.sr.ht/~martanne/devel 8 | about: The vis Mailing List. 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: Thank you for your interest in improving vis. 3 | title: "[Feature Request]:" 4 | labels: [meta:feature-request] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | ### The current practice and preferred location for large feature requests and general design discussion is the vis [mailing list](https://lists.sr.ht/~martanne/devel). 10 | 11 | - type: textarea 12 | attributes: 13 | label: What feature would you like to see? 14 | -------------------------------------------------------------------------------- /.github/workflows/luacheck.yml: -------------------------------------------------------------------------------- 1 | name: Lua Check 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'lua/**' 7 | 8 | jobs: 9 | luacheck: 10 | runs-on: ubuntu-latest 11 | steps: 12 | 13 | - name: Checkout 14 | uses: actions/checkout@v3 15 | 16 | - name: Dependency 17 | run: sudo apt install lua-check 18 | 19 | - name: Check 20 | run: make luacheck 21 | -------------------------------------------------------------------------------- /.github/workflows/luadoc.yml: -------------------------------------------------------------------------------- 1 | name: Lua API 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'vis-lua.c' 7 | - 'lua/**' 8 | 9 | jobs: 10 | luadoc: 11 | runs-on: ubuntu-latest 12 | steps: 13 | 14 | - name: Checkout 15 | uses: actions/checkout@v3 16 | 17 | - name: Dependency 18 | run: sudo apt install lua-ldoc 19 | 20 | - name: LDoc patch 21 | run: sudo patch -d /usr/share/lua/5.1 -p1 < lua/doc/README.md 22 | 23 | - name: Documentation generation 24 | run: make luadoc 25 | 26 | - name: Upload 27 | env: 28 | DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }} 29 | run: | 30 | git clone --depth=1 --single-branch --branch gh-pages "https://x-access-token:${DEPLOY_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" /tmp/gh-pages 31 | git config --global user.name "${GITHUB_ACTOR}" 32 | git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" 33 | mkdir -p /tmp/gh-pages/doc 34 | rm -f /tmp/gh-pages/doc/* 35 | cp -av lua/doc/*.html /tmp/gh-pages/doc/ 36 | cp -av lua/doc/*.css /tmp/gh-pages/doc/ 37 | cd /tmp/gh-pages 38 | git add -A && git commit --allow-empty -am "Publishing from ${GITHUB_REPOSITORY} ${GITHUB_SHA}" 39 | git push origin gh-pages 40 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: macOS 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: macos-latest 8 | strategy: 9 | matrix: 10 | config: 11 | - "" 12 | - --disable-curses 13 | - --disable-lua 14 | - --disable-tre 15 | - --disable-help 16 | env: 17 | CFLAGS_EXTRA: --coverage 18 | LDFLAGS_EXTRA: --coverage 19 | steps: 20 | 21 | - name: Checkout 22 | uses: actions/checkout@v4 23 | 24 | - name: Dependency Homebrew 25 | run: | 26 | brew install \ 27 | coreutils \ 28 | libtermkey \ 29 | lua \ 30 | luarocks \ 31 | tre \ 32 | pkg-config 33 | 34 | - name: Dependency LuaRocks 35 | run: | 36 | sudo luarocks install lpeg 37 | 38 | - name: Build 39 | run: | 40 | ./configure ${{ matrix.config }} 41 | make 42 | 43 | - name: Test 44 | run: | 45 | make test 46 | 47 | - name: Upload Test Coverage 48 | env: 49 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 50 | run: | 51 | curl -s https://codecov.io/bash > codecov 52 | curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/SHA256SUM > codecov.sha256 53 | if sha256sum -c --ignore-missing --status codecov.sha256 ; then 54 | bash < codecov || true 55 | else 56 | echo "Download checksum verification failed" 57 | fi 58 | -------------------------------------------------------------------------------- /.github/workflows/man.yml: -------------------------------------------------------------------------------- 1 | name: Manual 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'man/**' 7 | 8 | jobs: 9 | man: 10 | runs-on: ubuntu-latest 11 | steps: 12 | 13 | - name: Checkout 14 | uses: actions/checkout@v3 15 | 16 | - name: Dependency 17 | run: sudo apt install mandoc 18 | 19 | - name: Manual generation 20 | run: | 21 | make man 22 | wget -O - https://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz | tar -zxC man --strip-components 1 mandoc-1.14.6/mandoc.css 23 | 24 | - name: Upload 25 | env: 26 | DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | run: | 28 | git clone --depth=1 --single-branch --branch gh-pages "https://x-access-token:${DEPLOY_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" /tmp/gh-pages 29 | git config --global user.name "${GITHUB_ACTOR}" 30 | git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" 31 | mkdir -p /tmp/gh-pages/man 32 | cp -av /tmp/gh-pages/man/index.html man/ 33 | rm -f /tmp/gh-pages/man/* 34 | cp -av man/*.html /tmp/gh-pages/man/ 35 | cp -av man/*.css /tmp/gh-pages/man/ 36 | cd /tmp/gh-pages 37 | git add -A && git commit --allow-empty -am "Publishing from ${GITHUB_REPOSITORY} ${GITHUB_SHA}" 38 | git push origin gh-pages 39 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu.yml: -------------------------------------------------------------------------------- 1 | name: Ubuntu 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | strategy: 8 | matrix: 9 | config: 10 | - "" 11 | - --disable-curses 12 | - --disable-lua 13 | - --disable-tre 14 | - --disable-selinux 15 | - --disable-acl 16 | - --disable-help 17 | runs-on: ubuntu-latest 18 | env: 19 | CFLAGS_EXTRA: --coverage 20 | LDFLAGS_EXTRA: --coverage 21 | steps: 22 | 23 | - name: Checkout 24 | uses: actions/checkout@v3 25 | 26 | - name: Dependency 27 | run: | 28 | sudo apt install \ 29 | 9base \ 30 | libacl1-dev \ 31 | liblua5.3-dev \ 32 | libncursesw5-dev \ 33 | libselinux1-dev \ 34 | libtermkey-dev \ 35 | libtre-dev \ 36 | lua-lpeg 37 | 38 | - name: Build 39 | run: | 40 | ./configure ${{ matrix.config }} 41 | make 42 | 43 | - name: Test 44 | run: | 45 | make test 46 | 47 | - name: Upload Test Coverage 48 | env: 49 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 50 | run: | 51 | curl -s https://codecov.io/bash > codecov 52 | curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/SHA256SUM > codecov.sha256 53 | if sha256sum -c --ignore-missing --status codecov.sha256 ; then 54 | bash < codecov || true 55 | else 56 | echo "Download checksum verification failed" 57 | fi 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /config.h 2 | /config.mk 3 | /dependency 4 | /obj 5 | /vis 6 | /vis-menu 7 | /vis-single 8 | /vis-single-payload.inc 9 | /vis-digraph 10 | *.css 11 | *.gcda 12 | *.gcno 13 | *.gcov 14 | *.html 15 | *.d 16 | -------------------------------------------------------------------------------- /.luacheckrc: -------------------------------------------------------------------------------- 1 | -- std = "min" 2 | globals = { "vis" } 3 | include_files = { "lua/*.lua", "lua/**/*.lua", "test/lua/*.lua" } 4 | exclude_files = { "lua/lexer.lua", "lua/lexers/**", "test/lua/visrc.lua" } 5 | files["test/lua"] = { std = "+busted" } 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Run 'make docker' to build a statically linked vis executable! 2 | FROM i386/alpine:3.21 3 | RUN apk update && apk add --upgrade --no-cache \ 4 | acl-dev \ 5 | acl-static \ 6 | ca-certificates \ 7 | fortify-headers \ 8 | gcc \ 9 | libtermkey-dev \ 10 | lua5.4-dev \ 11 | lua5.4-lpeg \ 12 | lua-lpeg-dev \ 13 | make \ 14 | musl-dev \ 15 | ncurses-dev \ 16 | ncurses-static \ 17 | tar \ 18 | wget \ 19 | xz \ 20 | xz-dev \ 21 | xz-static 22 | RUN sed -i 's/Libs: /Libs: -L${INSTALL_CMOD} /' /usr/lib/pkgconfig/lua5.4.pc 23 | RUN mv /usr/lib/lua/5.4/lpeg.a /usr/lib/lua/5.4/liblpeg.a 24 | RUN sed -i 's/-ltermkey/-ltermkey -lunibilium/' /usr/lib/pkgconfig/termkey.pc 25 | # TODO contribute a proper libuntar package to Alpine 26 | RUN mkdir -p /build 27 | WORKDIR /build 28 | RUN wget https://github.com/martanne/libuntar/tarball/7c7247b442b021588f6deba78b60ef3b05ab1e0c -O libuntar.tar.gz && \ 29 | tar xf libuntar.tar.gz && cd *-libuntar-* && \ 30 | make && \ 31 | mkdir -p /usr/local/include && \ 32 | cp lib/libuntar.h /usr/local/include && \ 33 | cp lib/libuntar.a /usr/local/lib && \ 34 | rm -rf /build/*libuntar* 35 | CMD ["/bin/sh"] 36 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | build -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = VisEditor 8 | SOURCEDIR = . 9 | BUILDDIR = build/sphinx 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /doc/array.rst: -------------------------------------------------------------------------------- 1 | Array 2 | ===== 3 | 4 | .. doxygenfile:: array.h 5 | -------------------------------------------------------------------------------- /doc/buffer.rst: -------------------------------------------------------------------------------- 1 | Buffer 2 | ====== 3 | 4 | .. doxygenfile:: buffer.h 5 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | Vis Editor API Documentation 2 | ============================ 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | vis 8 | text 9 | view 10 | buffer 11 | array 12 | map 13 | -------------------------------------------------------------------------------- /doc/map.rst: -------------------------------------------------------------------------------- 1 | Map 2 | === 3 | 4 | .. doxygenfile:: map.h 5 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | breathe 2 | -------------------------------------------------------------------------------- /event-basic.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "vis-core.h" 4 | 5 | #if !CONFIG_LUA 6 | bool vis_event_emit(Vis *vis, enum VisEvents id, ...) { 7 | va_list ap; 8 | va_start(ap, id); 9 | 10 | if (id == VIS_EVENT_WIN_STATUS) { 11 | Win *win = va_arg(ap, Win*); 12 | window_status_update(vis, win); 13 | } 14 | 15 | va_end(ap); 16 | return true; 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /libutf.c: -------------------------------------------------------------------------------- 1 | /* libutf8 © 2012-2015 Connor Lane Smith */ 2 | #include "libutf.h" 3 | #include "util.h" 4 | 5 | int 6 | runelen(Rune r) 7 | { 8 | if(r <= 0x7F) 9 | return 1; 10 | else if(r <= 0x07FF) 11 | return 2; 12 | else if(r <= 0xD7FF) 13 | return 3; 14 | else if(r <= 0xDFFF) 15 | return 0; /* surrogate character */ 16 | else if(r <= 0xFFFD) 17 | return 3; 18 | else if(r <= 0xFFFF) 19 | return 0; /* illegal character */ 20 | else if(r <= Runemax) 21 | return 4; 22 | else 23 | return 0; /* rune too large */ 24 | } 25 | 26 | int 27 | runetochar(char *s, const Rune *p) 28 | { 29 | Rune r = *p; 30 | 31 | switch(runelen(r)) { 32 | case 1: /* 0aaaaaaa */ 33 | s[0] = r; 34 | return 1; 35 | case 2: /* 00000aaa aabbbbbb */ 36 | s[0] = 0xC0 | ((r & 0x0007C0) >> 6); /* 110aaaaa */ 37 | s[1] = 0x80 | (r & 0x00003F); /* 10bbbbbb */ 38 | return 2; 39 | case 3: /* aaaabbbb bbcccccc */ 40 | s[0] = 0xE0 | ((r & 0x00F000) >> 12); /* 1110aaaa */ 41 | s[1] = 0x80 | ((r & 0x000FC0) >> 6); /* 10bbbbbb */ 42 | s[2] = 0x80 | (r & 0x00003F); /* 10cccccc */ 43 | return 3; 44 | case 4: /* 000aaabb bbbbcccc ccdddddd */ 45 | s[0] = 0xF0 | ((r & 0x1C0000) >> 18); /* 11110aaa */ 46 | s[1] = 0x80 | ((r & 0x03F000) >> 12); /* 10bbbbbb */ 47 | s[2] = 0x80 | ((r & 0x000FC0) >> 6); /* 10cccccc */ 48 | s[3] = 0x80 | (r & 0x00003F); /* 10dddddd */ 49 | return 4; 50 | default: 51 | return 0; /* error */ 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /libutf.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBUTF_H 2 | #define LIBUTF_H 3 | 4 | /* libutf8 © 2012-2015 Connor Lane Smith */ 5 | #include 6 | #include 7 | 8 | #if __STDC_VERSION__ >= 201112L 9 | #include 10 | #ifdef __STDC_UTF_32__ 11 | #define RUNE_C INT32_C 12 | typedef char32_t Rune; 13 | #endif 14 | #endif 15 | 16 | #ifndef RUNE_C 17 | #ifdef INT32_C 18 | #define RUNE_C INT32_C 19 | typedef uint_least32_t Rune; 20 | #else 21 | #define RUNE_C(x) x##L 22 | typedef unsigned long Rune; 23 | #endif 24 | #endif 25 | 26 | #define UTFmax 4 /* maximum bytes per rune */ 27 | 28 | #define Runeself 0x80 /* rune and utf are equal (<) */ 29 | #define Runemax RUNE_C(0x10FFFF) /* maximum rune value */ 30 | 31 | int runelen(Rune r); 32 | int runetochar(char *s, const Rune *p); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /lua/doc/README.md: -------------------------------------------------------------------------------- 1 | This is the destination directory for the LDoc documentation of Vis' Lua API 2 | as generated by the `make luadoc`. 3 | 4 | Unfortunately `ldoc(1)` seems to have a bug which generates broken reference 5 | links for custom types. The following patch seems to fix the issue: 6 | 7 | ``` 8 | From 96a1fbc8e972fedf665049a6351f46bc1aac1768 Mon Sep 17 00:00:00 2001 9 | From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= 10 | Date: Tue, 6 Dec 2016 15:59:17 +0100 11 | Subject: [PATCH] Fix references to class types. 12 | 13 | For classes the generated HTML anchors need to be prefixed 'Class_'. 14 | --- 15 | ldoc/doc.lua | 6 +++--- 16 | 1 file changed, 3 insertions(+), 3 deletions(-) 17 | 18 | diff --git a/ldoc/doc.lua b/ldoc/doc.lua 19 | index e19b2df..f368b90 100644 20 | --- a/ldoc/doc.lua 21 | +++ b/ldoc/doc.lua 22 | @@ -1073,9 +1073,9 @@ end 23 | local function reference (s, mod_ref, item_ref) 24 | local name = item_ref and item_ref.name or '' 25 | -- this is deeply hacky; classes have 'Class ' prepended. 26 | ---~ if item_ref and doc.class_tag(item_ref.type) then 27 | ---~ name = 'Class_'..name 28 | ---~ end 29 | + if item_ref and doc.class_tag(item_ref.type) then 30 | + name = 'Class_'..name 31 | + end 32 | return {mod = mod_ref, name = name, label=s} 33 | end 34 | 35 | -- 36 | 1.9.1 37 | ``` 38 | -------------------------------------------------------------------------------- /lua/doc/config.ld: -------------------------------------------------------------------------------- 1 | -- Configuration file for Luadoc API generation 2 | project="Vis Editor" 3 | title="Vis Editor Lua API documentation" 4 | format="markdown" 5 | style="!fixed" 6 | dir="." 7 | sort=true 8 | merge=true 9 | no_space_before_args=true 10 | not_luadoc=true 11 | file={ 12 | "../../vis-lua.c", 13 | "../vis.lua", 14 | } 15 | -------------------------------------------------------------------------------- /lua/lexer.lua: -------------------------------------------------------------------------------- 1 | lexers/lexer.lua -------------------------------------------------------------------------------- /lua/lexers/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007-2017 Mitchell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /lua/lexers/asp.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- ASP LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local html = lexer.load('html') 8 | local lex = lexer.new(..., {inherit = html}) -- proxy for HTML 9 | 10 | -- Embedded VB. 11 | local vb = lexer.load('vb') 12 | local vb_start_rule = lex:tag(lexer.PREPROCESSOR, '<%' * P('=')^-1) 13 | local vb_end_rule = lex:tag(lexer.PREPROCESSOR, '%>') 14 | lex:embed(vb, vb_start_rule, vb_end_rule) 15 | 16 | -- Embedded VBScript. 17 | local vbs = lexer.load('vb', 'vbscript') 18 | local script_element = lexer.word_match('script', true) 19 | local vbs_start_rule = #('<' * script_element * (P(function(input, index) 20 | if input:find('^%s+language%s*=%s*(["\'])vbscript%1', index) or 21 | input:find('^%s+type%s*=%s*(["\'])text/vbscript%1', index) then return true end 22 | end) + '>')) * html.embed_start_tag -- 24 | lex:embed(vbs, vbs_start_rule, vbs_end_rule) 25 | 26 | -- Fold points. 27 | lex:add_fold_point(lexer.PREPROCESSOR, '<%', '%>') 28 | 29 | lexer.property['scintillua.comment'] = '' 30 | 31 | return lex 32 | -------------------------------------------------------------------------------- /lua/lexers/container.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Container LPeg lexer. 3 | -- This is SciTE's plain text lexer. 4 | 5 | return require('lexer').new('container') 6 | -------------------------------------------------------------------------------- /lua/lexers/desktop.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Desktop Entry LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(...) 8 | 9 | -- Keys. 10 | lex:add_rule('key', lex:tag(lexer.VARIABLE_BUILTIN, lex:word_match(lexer.VARIABLE_BUILTIN))) 11 | 12 | -- Values. 13 | lex:add_rule('value', lex:tag(lexer.CONSTANT_BUILTIN, lexer.word_match('true false'))) 14 | 15 | -- Identifiers. 16 | lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.alpha * (lexer.alnum + S('_-'))^0)) 17 | 18 | -- Group headers. 19 | local bracketed = lexer.range('[', ']') 20 | lex:add_rule('header', lexer.starts_line(lex:tag(lexer.HEADING, bracketed))) 21 | 22 | -- Locales. 23 | lex:add_rule('locale', lex:tag(lexer.TYPE, bracketed)) 24 | 25 | -- Strings. 26 | lex:add_rule('string', lex:tag(lexer.STRING, lexer.range('"'))) 27 | 28 | -- Comments. 29 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('#'))) 30 | 31 | -- Numbers. 32 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number)) 33 | 34 | -- Field codes. 35 | lex:add_rule('code', lex:tag(lexer.CONSTANT_BUILTIN, '%' * S('fFuUdDnNickvm'))) 36 | 37 | -- Operators. 38 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('='))) 39 | 40 | -- Word lists. 41 | lex:set_word_list(lexer.VARIABLE_BUILTIN, { 42 | 'Type', 'Version', 'Name', 'GenericName', 'NoDisplay', 'Comment', 'Icon', 'Hidden', 'OnlyShowIn', 43 | 'NotShowIn', 'TryExec', 'Exec', 'Exec', 'Path', 'Terminal', 'MimeType', 'Categories', 44 | 'StartupNotify', 'StartupWMClass', 'URL' 45 | }) 46 | 47 | lexer.property['scintillua.comment'] = '#' 48 | 49 | return lex 50 | -------------------------------------------------------------------------------- /lua/lexers/diff.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Diff LPeg lexer. 3 | 4 | local lexer = lexer 5 | local to_eol, starts_line = lexer.to_eol, lexer.starts_line 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new(..., {lex_by_line = true}) 9 | 10 | -- Text, file headers, and separators. 11 | lex:add_rule('index', lex:tag(lexer.COMMENT, to_eol(starts_line('Index: ')))) 12 | lex:add_rule('header', lex:tag(lexer.HEADING, to_eol(starts_line(P('*** ') + '--- ' + '+++ ')))) 13 | lex:add_rule('separator', lex:tag(lexer.COMMENT, to_eol(starts_line(P('---') + '****' + '=')))) 14 | 15 | -- Location. 16 | lex:add_rule('location', lex:tag(lexer.NUMBER, to_eol(starts_line('@@' + lexer.dec_num + '****')))) 17 | 18 | -- Additions, deletions, and changes. 19 | lex:add_rule('addition', lex:tag('addition', to_eol(starts_line(S('>+'))))) 20 | lex:add_rule('deletion', lex:tag('deletion', to_eol(starts_line(S('<-'))))) 21 | lex:add_rule('change', lex:tag('change', to_eol(starts_line('!')))) 22 | 23 | lex:add_rule('any_line', lex:tag(lexer.DEFAULT, lexer.to_eol())) 24 | 25 | return lex 26 | -------------------------------------------------------------------------------- /lua/lexers/dockerfile.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2016-2025 Alejandro Baez (https://keybase.io/baez). See LICENSE. 2 | -- Dockerfile LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S, B = lpeg.P, lpeg.S, lpeg.B 6 | 7 | local lex = lexer.new(..., {fold_by_indentation = true}) 8 | 9 | -- Keywords. 10 | local keyword = lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD)) 11 | lex:add_rule('keyword', keyword) 12 | 13 | -- Identifiers. 14 | lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word)) 15 | 16 | -- Variable. 17 | lex:add_rule('variable', 18 | -B('\\') * lex:tag(lexer.OPERATOR, '$' * P('{')^-1) * lex:tag(lexer.VARIABLE, lexer.word)) 19 | 20 | -- Strings. 21 | local sq_str = lexer.range("'", false, false) 22 | local dq_str = lexer.range('"') 23 | lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str)) 24 | 25 | -- Comments. 26 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('#'))) 27 | 28 | -- Numbers. 29 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number)) 30 | 31 | -- Operators. 32 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('\\[],=:{}'))) 33 | 34 | local bash = lexer.load('bash') 35 | local start_rule = #P('RUN') * keyword * bash:get_rule('whitespace') 36 | local end_rule = -B('\\') * #lexer.newline * lex:get_rule('whitespace') 37 | lex:embed(bash, start_rule, end_rule) 38 | 39 | -- Word lists. 40 | lex:set_word_list(lexer.KEYWORD, { 41 | 'ADD', 'ARG', 'CMD', 'COPY', 'ENTRYPOINT', 'ENV', 'EXPOSE', 'FROM', 'LABEL', 'MAINTAINER', 42 | 'ONBUILD', 'RUN', 'STOPSIGNAL', 'USER', 'VOLUME', 'WORKDIR' 43 | }) 44 | 45 | lexer.property['scintillua.comment'] = '#' 46 | 47 | return lex 48 | -------------------------------------------------------------------------------- /lua/lexers/dsv.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2016 Christian Hesse 2 | -- delimiter separated values LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | local token = lexer.token 6 | local S = lpeg.S 7 | 8 | local lex = lexer.new('dsv') 9 | 10 | lex:add_rule('operator', token(lexer.OPERATOR, S(',;:|'))) 11 | 12 | return lex 13 | -------------------------------------------------------------------------------- /lua/lexers/elm.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2020-2025 Mitchell. See LICENSE. 2 | -- Elm LPeg lexer 3 | -- Adapted from Haskell LPeg lexer by Karl Schultheisz. 4 | 5 | local lexer = require('lexer') 6 | local token, word_match = lexer.token, lexer.word_match 7 | local P, S = lpeg.P, lpeg.S 8 | 9 | local lex = lexer.new('elm', {fold_by_indentation = true}) 10 | 11 | -- Whitespace. 12 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 13 | 14 | -- Keywords. 15 | lex:add_rule('keyword', token(lexer.KEYWORD, word_match( 16 | 'if then else case of let in module import as exposing type alias port'))) 17 | 18 | -- Types & type constructors. 19 | local word = (lexer.alnum + S("._'#"))^0 20 | local op = lexer.punct - S('()[]{}') 21 | lex:add_rule('type', token(lexer.TYPE, lexer.upper * word + ':' * (op^1 - ':'))) 22 | 23 | -- Identifiers. 24 | lex:add_rule('identifier', token(lexer.IDENTIFIER, (lexer.alpha + '_') * word)) 25 | 26 | -- Strings. 27 | lex:add_rule('string', token(lexer.STRING, lexer.range('"'))) 28 | 29 | -- Chars. 30 | lex:add_rule('character', token(lexer.STRING, lexer.range("'", true))) 31 | 32 | -- Comments. 33 | local line_comment = lexer.to_eol('--', true) 34 | local block_comment = lexer.range('{-', '-}', false, false, true) 35 | lex:add_rule('comment', token(lexer.COMMENT, line_comment + block_comment)) 36 | 37 | -- Numbers. 38 | lex:add_rule('number', token(lexer.NUMBER, lexer.number)) 39 | 40 | -- Operators. 41 | lex:add_rule('operator', token(lexer.OPERATOR, op)) 42 | 43 | lexer.property['scintillua.comment'] = '--' 44 | 45 | return lex 46 | -------------------------------------------------------------------------------- /lua/lexers/gap.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Gap LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | local token, word_match = lexer.token, lexer.word_match 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new('gap') 9 | 10 | -- Whitespace. 11 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 12 | 13 | -- Keywords. 14 | lex:add_rule('keyword', token(lexer.KEYWORD, word_match{ 15 | 'and', 'break', 'continue', 'do', 'elif', 'else', 'end', 'fail', 'false', 'fi', 'for', 'function', 16 | 'if', 'in', 'infinity', 'local', 'not', 'od', 'or', 'rec', 'repeat', 'return', 'then', 'true', 17 | 'until', 'while' 18 | })) 19 | 20 | -- Identifiers. 21 | lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) 22 | 23 | -- Strings. 24 | local sq_str = lexer.range("'", true) 25 | local dq_str = lexer.range('"', true) 26 | lex:add_rule('string', token(lexer.STRING, sq_str + dq_str)) 27 | 28 | -- Comments. 29 | lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#'))) 30 | 31 | -- Numbers. 32 | lex:add_rule('number', token(lexer.NUMBER, lexer.dec_num * -lexer.alpha)) 33 | 34 | -- Operators. 35 | lex:add_rule('operator', token(lexer.OPERATOR, S('*+-,./:;<=>~^#()[]{}'))) 36 | 37 | -- Fold points. 38 | lex:add_fold_point(lexer.KEYWORD, 'function', 'end') 39 | lex:add_fold_point(lexer.KEYWORD, 'do', 'od') 40 | lex:add_fold_point(lexer.KEYWORD, 'if', 'fi') 41 | lex:add_fold_point(lexer.KEYWORD, 'repeat', 'until') 42 | 43 | lexer.property['scintillua.comment'] = '#' 44 | 45 | return lex 46 | -------------------------------------------------------------------------------- /lua/lexers/gemini.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2020-2025 Haelwenn (lanodan) Monnier . See LICENSE. 2 | -- Gemini / Gemtext LPeg lexer. 3 | -- See https://gemini.circumlunar.space/docs/specification.html 4 | 5 | local lexer = lexer 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new(...) 9 | 10 | local header = lex:tag(lexer.HEADING .. '.h3', lexer.to_eol(lexer.starts_line('###'))) + 11 | lex:tag(lexer.HEADING .. '.h2', lexer.to_eol(lexer.starts_line('##'))) + 12 | lex:tag(lexer.HEADING .. '.h1', lexer.to_eol(lexer.starts_line('#'))) 13 | lex:add_rule('header', header) 14 | 15 | lex:add_rule('list', lex:tag(lexer.LIST, lexer.to_eol(lexer.starts_line('*')))) 16 | 17 | lex:add_rule('blockquote', lex:tag(lexer.STRING, lexer.to_eol(lexer.starts_line('>')))) 18 | 19 | lex:add_rule('pre', lex:tag(lexer.CODE, lexer.to_eol(lexer.range('```', false, true)))) 20 | 21 | lex:add_rule('link', lex:tag(lexer.LINK, lexer.to_eol(lexer.starts_line('=>')))) 22 | 23 | return lex 24 | -------------------------------------------------------------------------------- /lua/lexers/gettext.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Gettext LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | local token, word_match = lexer.token, lexer.word_match 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new('gettext') 9 | 10 | -- Whitespace. 11 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 12 | 13 | -- Keywords. 14 | lex:add_rule('keyword', token(lexer.KEYWORD, word_match( 15 | 'msgid msgid_plural msgstr fuzzy c-format no-c-format', true))) 16 | 17 | -- Identifiers. 18 | lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) 19 | 20 | -- Variables. 21 | lex:add_rule('variable', token(lexer.VARIABLE, S('%$@') * lexer.word)) 22 | 23 | -- Strings. 24 | lex:add_rule('string', token(lexer.STRING, lexer.range('"', true))) 25 | 26 | -- Comments. 27 | lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#' * S(': .~')))) 28 | 29 | lexer.property['scintillua.comment'] = '#' 30 | 31 | return lex 32 | -------------------------------------------------------------------------------- /lua/lexers/gherkin.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2015-2025 Jason Schindler. See LICENSE. 2 | -- Gherkin (https://github.com/cucumber/cucumber/wiki/Gherkin) LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | local token, word_match = lexer.token, lexer.word_match 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new('gherkin', {fold_by_indentation = true}) 9 | 10 | -- Whitespace. 11 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 12 | 13 | -- Keywords. 14 | lex:add_rule('keyword', token(lexer.KEYWORD, word_match( 15 | 'And Background But Examples Feature Given Outline Scenario Scenarios Then When'))) 16 | 17 | -- Strings. 18 | local doc_str = lexer.range('"""') 19 | local dq_str = lexer.range('"') 20 | lex:add_rule('string', token(lexer.STRING, doc_str + dq_str)) 21 | 22 | -- Comments. 23 | lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#'))) 24 | 25 | -- Numbers. 26 | -- lex:add_rule('number', token(lexer.NUMBER, lexer.number)) 27 | 28 | -- Tags. 29 | lex:add_rule('tag', token(lexer.LABEL, '@' * lexer.word^0)) 30 | 31 | -- Placeholders. 32 | lex:add_rule('placeholder', token(lexer.VARIABLE, lexer.range('<', '>', false, false, true))) 33 | 34 | -- Examples. 35 | lex:add_rule('example', token(lexer.DEFAULT, lexer.to_eol('|'))) 36 | 37 | lexer.property['scintillua.comment'] = '#' 38 | 39 | return lex 40 | -------------------------------------------------------------------------------- /lua/lexers/git-rebase.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2017-2025 Marc André Tanner. See LICENSE. 2 | -- git-rebase(1) LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, R = lpeg.P, lpeg.R 6 | 7 | local lex = lexer.new(..., {lex_by_line = true}) 8 | 9 | -- Comments. 10 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol(lexer.starts_line('#')))) 11 | 12 | -- Keywords. 13 | lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lexer.starts_line(lex:word_match(lexer.KEYWORD)))) 14 | 15 | -- Commit SHA1. 16 | local function patn(pat, min, max) 17 | return -pat^(max + 1) * pat^min 18 | end 19 | 20 | lex:add_rule('commit', lex:tag(lexer.NUMBER, patn(R('09', 'af'), 7, 40))) 21 | 22 | lex:add_rule('message', lex:tag('message', lexer.to_eol())) 23 | 24 | -- Word lists. 25 | lex:set_word_list(lexer.KEYWORD, [[ 26 | p pick 27 | r reword 28 | e edit 29 | s squash 30 | f fixup 31 | x exec 32 | d drop 33 | b break 34 | l label 35 | t reset 36 | m merge 37 | ]]) 38 | 39 | return lex 40 | -------------------------------------------------------------------------------- /lua/lexers/haskell.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Haskell LPeg lexer. 3 | -- Modified by Alex Suraci. 4 | -- Migrated by Samuel Marquis. 5 | 6 | local lexer = lexer 7 | local P, S = lpeg.P, lpeg.S 8 | 9 | local lex = lexer.new(..., {fold_by_indentation = true}) 10 | 11 | -- Keywords. 12 | lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD))) 13 | 14 | -- Types & type constructors. 15 | local word = (lexer.alnum + S("._'#"))^0 16 | local op = lexer.punct - S('()[]{}') 17 | lex:add_rule('type', lex:tag(lexer.TYPE, (lexer.upper * word) + (':' * (op^1 - ':')))) 18 | 19 | -- Identifiers. 20 | lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, (lexer.alpha + '_') * word)) 21 | 22 | -- Strings. 23 | local sq_str = lexer.range("'", true) 24 | local dq_str = lexer.range('"') 25 | lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str)) 26 | 27 | -- Comments. 28 | local line_comment = lexer.to_eol('--', true) 29 | local block_comment = lexer.range('{-', '-}') 30 | lex:add_rule('comment', lex:tag(lexer.COMMENT, line_comment + block_comment)) 31 | 32 | -- Numbers. 33 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number)) 34 | 35 | -- Operators. 36 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, op)) 37 | 38 | lexer.property['scintillua.comment'] = '--' 39 | 40 | -- Word lists. 41 | lex:set_word_list(lexer.KEYWORD, { 42 | 'case', 'class', 'data', 'default', 'deriving', 'do', 'else', 'if', 'import', 'in', 'infix', 43 | 'infixl', 'infixr', 'instance', 'let', 'module', 'newtype', 'of', 'then', 'type', 'where', '_', 44 | 'as', 'qualified', 'hiding' 45 | }) 46 | 47 | return lex 48 | -------------------------------------------------------------------------------- /lua/lexers/ini.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Ini LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | local token, word_match = lexer.token, lexer.word_match 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new('ini') 9 | 10 | -- Whitespace. 11 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 12 | 13 | -- Keywords. 14 | lex:add_rule('keyword', token(lexer.KEYWORD, word_match('true false on off yes no'))) 15 | 16 | -- Identifiers. 17 | lex:add_rule('identifier', token(lexer.IDENTIFIER, (lexer.alpha + '_') * (lexer.alnum + S('_.'))^0)) 18 | 19 | -- Strings. 20 | local sq_str = lexer.range("'") 21 | local dq_str = lexer.range('"') 22 | lex:add_rule('string', token(lexer.STRING, sq_str + dq_str)) 23 | 24 | -- Labels. 25 | lex:add_rule('label', token(lexer.LABEL, lexer.range('[', ']', true))) 26 | 27 | -- Comments. 28 | lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol(lexer.starts_line(S(';#'))))) 29 | 30 | -- Numbers. 31 | local integer = S('+-')^-1 * (lexer.hex_num + lexer.oct_num_('_') + lexer.dec_num_('_')) 32 | lex:add_rule('number', token(lexer.NUMBER, lexer.float + integer)) 33 | 34 | -- Operators. 35 | lex:add_rule('operator', token(lexer.OPERATOR, '=')) 36 | 37 | lexer.property['scintillua.comment'] = '#' 38 | 39 | return lex 40 | -------------------------------------------------------------------------------- /lua/lexers/json.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Brian "Sir Alaran" Schott. See LICENSE. 2 | -- JSON LPeg lexer. 3 | -- Based off of lexer code by Mitchell. 4 | 5 | local lexer = lexer 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new(...) 9 | 10 | -- Strings. 11 | local sq_str = lexer.range("'", true) 12 | local dq_str = lexer.range('"', true) 13 | lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str)) 14 | 15 | -- Keywords. 16 | lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lexer.word_match('true false null'))) 17 | 18 | -- Numbers. 19 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number)) 20 | 21 | -- Operators. 22 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('[]{}:,'))) 23 | 24 | -- Fold points. 25 | lex:add_fold_point(lexer.OPERATOR, '[', ']') 26 | lex:add_fold_point(lexer.OPERATOR, '{', '}') 27 | 28 | return lex 29 | -------------------------------------------------------------------------------- /lua/lexers/jsp.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- JSP LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(..., {inherit = lexer.load('html')}) 8 | 9 | -- Embedded Java. 10 | local java = lexer.load('java') 11 | local java_start_rule = lex:tag(lexer.PREPROCESSOR, '<%' * P('=')^-1) 12 | local java_end_rule = lex:tag(lexer.PREPROCESSOR, '%>') 13 | lex:embed(java, java_start_rule, java_end_rule, true) 14 | 15 | -- Fold points. 16 | lex:add_fold_point(lexer.PREPROCESSOR, '<%', '%>') 17 | 18 | lexer.property['scintillua.comment'] = '' 19 | 20 | return lex 21 | -------------------------------------------------------------------------------- /lua/lexers/less.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Robert Gieseke. See LICENSE. 2 | -- Less CSS LPeg lexer. 3 | -- http://lesscss.org 4 | 5 | local lexer = require('lexer') 6 | local token = lexer.token 7 | local S = lpeg.S 8 | 9 | local lex = lexer.new('less', {inherit = lexer.load('css')}) 10 | 11 | -- Line comments. 12 | lex:add_rule('line_comment', token(lexer.COMMENT, lexer.to_eol('//'))) 13 | 14 | -- Variables. 15 | lex:add_rule('variable', token(lexer.VARIABLE, '@' * (lexer.alnum + S('_-{}'))^1)) 16 | 17 | lexer.property['scintillua.comment'] = '//' 18 | 19 | return lex 20 | -------------------------------------------------------------------------------- /lua/lexers/lilypond.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Robert Gieseke. See LICENSE. 2 | -- Lilypond LPeg lexer. 3 | -- TODO Embed Scheme; Notes?, Numbers? 4 | 5 | local lexer = require('lexer') 6 | local token, word_match = lexer.token, lexer.word_match 7 | local P, S = lpeg.P, lpeg.S 8 | 9 | local lex = lexer.new('lilypond') 10 | 11 | -- Whitespace. 12 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 13 | 14 | -- Keywords, commands. 15 | lex:add_rule('keyword', token(lexer.KEYWORD, '\\' * lexer.word)) 16 | 17 | -- Identifiers. 18 | lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) 19 | 20 | -- Strings. 21 | lex:add_rule('string', token(lexer.STRING, lexer.range('"', false, false))) 22 | 23 | -- Comments. 24 | -- TODO: block comment. 25 | lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('%'))) 26 | 27 | -- Operators. 28 | lex:add_rule('operator', token(lexer.OPERATOR, S("{}'~<>|"))) 29 | 30 | lexer.property['scintillua.comment'] = '%' 31 | 32 | return lex 33 | -------------------------------------------------------------------------------- /lua/lexers/litcoffee.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Robert Gieseke. See LICENSE. 2 | -- Literate CoffeeScript LPeg lexer. 3 | -- http://coffeescript.org/#literate 4 | 5 | local lexer = lexer 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new(..., {inherit = lexer.load('markdown')}) 9 | 10 | -- Distinguish between horizontal and vertical space so coffee_start_rule has a chance to match. 11 | lex:modify_rule('whitespace', lex:tag(lexer.WHITESPACE, S(' \t')^1 + S('\r\n')^1)) 12 | 13 | -- Embedded CoffeeScript. 14 | local coffeescript = lexer.load('coffeescript') 15 | local coffee_start_rule = #(P(' ')^4 + P('\t')) * lex:get_rule('whitespace') 16 | local coffee_end_rule = #lexer.newline * lex:get_rule('whitespace') 17 | lex:embed(coffeescript, coffee_start_rule, coffee_end_rule) 18 | 19 | return lex 20 | -------------------------------------------------------------------------------- /lua/lexers/man.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2015-2022 David B. Lamkins . See LICENSE. 2 | -- man/roff LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | local token, word_match = lexer.token, lexer.word_match 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new('man') 9 | 10 | -- Whitespace. 11 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 12 | 13 | -- Markup. 14 | lex:add_rule('rule1', token(lexer.STRING, '.' * lexer.to_eol('B' * P('R')^-1 + 'I' * P('PR')^-1))) 15 | lex:add_rule('rule2', token(lexer.NUMBER, lexer.to_eol('.' * S('ST') * 'H'))) 16 | lex:add_rule('rule3', token(lexer.KEYWORD, P('.br') + '.DS' + '.RS' + '.RE' + '.PD')) 17 | lex:add_rule('rule4', token(lexer.LABEL, '.' * (S('ST') * 'H' + '.TP'))) 18 | lex:add_rule('rule5', token(lexer.VARIABLE, '.B' * P('R')^-1 + '.I' * S('PR')^-1 + '.PP')) 19 | lex:add_rule('rule6', token(lexer.TYPE, '\\f' * S('BIPR'))) 20 | lex:add_rule('rule7', token(lexer.PREPROCESSOR, lexer.starts_line('.') * lexer.alpha^1)) 21 | 22 | return lex 23 | -------------------------------------------------------------------------------- /lua/lexers/null.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Null LPeg lexer. 3 | 4 | return require('lexer').new('null') 5 | -------------------------------------------------------------------------------- /lua/lexers/pico8.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2016-2025 Alejandro Baez (https://keybase.io/baez). See LICENSE. 2 | -- PICO-8 lexer. 3 | -- http://www.lexaloffle.com/pico-8.php 4 | 5 | local lexer = lexer 6 | local word_match = lexer.word_match 7 | local P, S = lpeg.P, lpeg.S 8 | 9 | local lex = lexer.new(...) 10 | 11 | -- Keywords 12 | lex:add_rule('keyword', 13 | lex:tag(lexer.KEYWORD, lexer.word_match('__gff__ __map__ __sfx__ __music__'))) 14 | 15 | -- Identifiers 16 | lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word)) 17 | 18 | -- Comments 19 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('//', true))) 20 | 21 | -- Numbers 22 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.integer)) 23 | 24 | -- Operators 25 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, '_')) 26 | 27 | -- Embed Lua into PICO-8. 28 | local lua = lexer.load('lua') 29 | local lua_start_rule = lex:tag(lexer.KEYWORD, word_match('__lua__')) 30 | local lua_end_rule = lex:tag(lexer.KEYWORD, word_match('__gfx__')) 31 | lex:embed(lua, lua_start_rule, lua_end_rule) 32 | 33 | lexer.property['scintillua.comment'] = '//' 34 | 35 | return lex 36 | -------------------------------------------------------------------------------- /lua/lexers/props.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Props LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(..., {lex_by_line = true}) 8 | 9 | -- Identifiers. 10 | lex:add_rule('identifier', 11 | lex:tag(lexer.IDENTIFIER, (lexer.alpha + S('.-_')) * (lexer.alnum + S('.-_')^0))) 12 | 13 | -- Colors. 14 | local xdigit = lexer.xdigit 15 | lex:add_rule('color', 16 | lex:tag(lexer.NUMBER, '#' * xdigit * xdigit * xdigit * xdigit * xdigit * xdigit)) 17 | 18 | -- Comments. 19 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('#'))) 20 | 21 | -- Equals. 22 | lex:add_rule('equals', lex:tag(lexer.OPERATOR, '=')) 23 | 24 | -- Strings. 25 | local sq_str = lexer.range("'") 26 | local dq_str = lexer.range('"') 27 | lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str)) 28 | 29 | -- Variables. 30 | lex:add_rule('variable', 31 | lex:tag(lexer.OPERATOR, '$(') * lex:tag(lexer.VARIABLE, (lexer.nonnewline - lexer.space - ')')^0) * 32 | lex:tag(lexer.OPERATOR, ')')) 33 | 34 | lexer.property['scintillua.comment'] = '#' 35 | 36 | return lex 37 | -------------------------------------------------------------------------------- /lua/lexers/rhtml.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- RHTML LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(..., {inherit = lexer.load('html')}) 8 | 9 | -- Embedded Ruby. 10 | local ruby = lexer.load('rails') 11 | local ruby_start_rule = lex:tag(lexer.PREPROCESSOR, '<%' * P('=')^-1) 12 | local ruby_end_rule = lex:tag(lexer.PREPROCESSOR, '%>') 13 | lex:embed(ruby, ruby_start_rule, ruby_end_rule) 14 | 15 | -- Fold points. 16 | lex:add_fold_point(lexer.PREPROCESSOR, '<%', '%>') 17 | 18 | lexer.property['scintillua.comment'] = '' 19 | 20 | return lex 21 | -------------------------------------------------------------------------------- /lua/lexers/rpmspec.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2022-2025 Matej Cepl mcepl.att.cepl.eu. See LICENSE. 2 | 3 | local lexer = require('lexer') 4 | local token, word_match = lexer.token, lexer.word_match 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new('rpmspec') 8 | 9 | -- Whitespace. 10 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 11 | 12 | -- Comments. 13 | lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#'))) 14 | 15 | -- Strings. 16 | lex:add_rule('string', token(lexer.STRING, lexer.range('"'))) 17 | 18 | -- Keywords. 19 | lex:add_rule('keyword', token(lexer.KEYWORD, word_match{ 20 | 'Prereq', 'Summary', 'Name', 'Version', 'Packager', 'Requires', 'Recommends', 'Suggests', 21 | 'Supplements', 'Enhances', 'Icon', 'URL', 'Source', 'Patch', 'Prefix', 'Packager', 'Group', 22 | 'License', 'Release', 'BuildRoot', 'Distribution', 'Vendor', 'Provides', 'ExclusiveArch', 23 | 'ExcludeArch', 'ExclusiveOS', 'Obsoletes', 'BuildArch', 'BuildArchitectures', 'BuildRequires', 24 | 'BuildConflicts', 'BuildPreReq', 'Conflicts', 'AutoRequires', 'AutoReq', 'AutoReqProv', 25 | 'AutoProv', 'Epoch' 26 | })) 27 | 28 | -- Macros 29 | lex:add_rule('command', token(lexer.FUNCTION, '%' * lexer.word)) 30 | 31 | lexer.property['scintillua.comment'] = '#' 32 | 33 | return lex 34 | -------------------------------------------------------------------------------- /lua/lexers/sass.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Robert Gieseke. See LICENSE. 2 | -- Sass CSS preprocessor LPeg lexer. 3 | -- http://sass-lang.com 4 | 5 | local lexer = lexer 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new(..., {inherit = lexer.load('css')}) 9 | 10 | -- Line comments. 11 | lex:add_rule('line_comment', lex:tag(lexer.COMMENT, lexer.to_eol('//'))) 12 | 13 | -- Variables. 14 | lex:add_rule('variable', lex:tag(lexer.VARIABLE, '$' * (lexer.alnum + S('_-'))^1)) 15 | 16 | -- Mixins. 17 | lex:add_rule('mixin', lex:tag(lexer.PREPROCESSOR, '@' * lexer.word)) 18 | 19 | lexer.property['scintillua.comment'] = '//' 20 | 21 | return lex 22 | -------------------------------------------------------------------------------- /lua/lexers/smalltalk.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Smalltalk LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | local token, word_match = lexer.token, lexer.word_match 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new('smalltalk') 9 | 10 | -- Whitespace. 11 | lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) 12 | 13 | -- Keywords. 14 | lex:add_rule('keyword', token(lexer.KEYWORD, word_match( 15 | 'true false nil self super isNil not Smalltalk Transcript'))) 16 | 17 | -- Types. 18 | lex:add_rule('type', token(lexer.TYPE, word_match( 19 | 'Date Time Boolean True False Character String Array Symbol Integer Object'))) 20 | 21 | -- Identifiers. 22 | lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) 23 | 24 | -- Strings. 25 | local sq_str = lexer.range("'") 26 | local word_str = '$' * lexer.word 27 | lex:add_rule('string', token(lexer.STRING, sq_str + word_str)) 28 | 29 | -- Comments. 30 | lex:add_rule('comment', token(lexer.COMMENT, lexer.range('"', false, false))) 31 | 32 | -- Numbers. 33 | lex:add_rule('number', token(lexer.NUMBER, lexer.number)) 34 | 35 | -- Operators. 36 | lex:add_rule('operator', token(lexer.OPERATOR, S(':=_<>+-/*!()[]'))) 37 | 38 | -- Labels. 39 | lex:add_rule('label', token(lexer.LABEL, '#' * lexer.word)) 40 | 41 | -- Fold points. 42 | lex:add_fold_point(lexer.OPERATOR, '[', ']') 43 | 44 | lexer.property['scintillua.comment'] = '"|"' 45 | 46 | return lex 47 | -------------------------------------------------------------------------------- /lua/lexers/strace.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2017-2025 Marc André Tanner. See LICENSE. 2 | -- strace(1) output lexer 3 | 4 | local lexer = lexer 5 | local S, B = lpeg.S, lpeg.B 6 | 7 | local lex = lexer.new(..., {lex_by_line = true}) 8 | 9 | -- Syscall 10 | lex:add_rule('syscall', lex:tag(lexer.FUNCTION, lexer.starts_line(lexer.word))) 11 | 12 | -- Upper case constants 13 | lex:add_rule('constant', 14 | lex:tag(lexer.CONSTANT, (lexer.upper + '_') * (lexer.upper + lexer.digit + '_')^0)) 15 | 16 | -- Single and double quoted strings 17 | local sq_str = lexer.range("'", true) 18 | local dq_str = lexer.range('"', true) 19 | lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str)) 20 | 21 | -- Comments and text in parentheses at the line end 22 | local comment = lexer.range('/*', '*/') 23 | local description = lexer.range('(', ')') * lexer.newline 24 | lex:add_rule('comment', lex:tag(lexer.COMMENT, comment + description)) 25 | 26 | lex:add_rule('result', lex:tag(lexer.TYPE, B(' = ') * lexer.integer)) 27 | lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word)) 28 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.float + lexer.integer)) 29 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('+-/*%<>~!=^&|?~:;,.()[]{}'))) 30 | 31 | return lex 32 | -------------------------------------------------------------------------------- /lua/lexers/taskpaper.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2016-2025 Larry Hynes. See LICENSE. 2 | -- Taskpaper LPeg lexer 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(..., {lex_by_line = true}) 8 | 9 | -- Notes. 10 | local delimiter = lpeg.B(' ') + lpeg.B('\t') 11 | lex:add_rule('note', delimiter * lex:tag('note', lexer.to_eol(lexer.alnum))) 12 | 13 | -- Tasks. 14 | lex:add_rule('task', delimiter * lex:tag(lexer.LIST, '-')) 15 | 16 | -- Projects. 17 | lex:add_rule('project', lex:tag(lexer.HEADING, 18 | lexer.range(lexer.starts_line(lexer.alnum), ':') * lexer.newline)) 19 | 20 | -- Tags. 21 | lex:add_rule('extended_tag', lex:tag(lexer.TAG .. '.extended', '@' * lexer.word * '(' * 22 | (lexer.word + lexer.digit + '-')^1 * ')')) 23 | lex:add_rule('day_tag', lex:tag(lexer.TAG .. '.day', (P('@today') + '@tomorrow'))) 24 | lex:add_rule('overdue_tag', lex:tag(lexer.TAG .. '.overdue', '@overdue')) 25 | lex:add_rule('plain_tag', lex:tag(lexer.TAG .. '.plain', '@' * lexer.word)) 26 | 27 | return lex 28 | -------------------------------------------------------------------------------- /lua/lexers/template.txt: -------------------------------------------------------------------------------- 1 | -- Copyright 2022-2025 Mitchell. See LICENSE. 2 | -- ? LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(...) 8 | 9 | -- Keywords. 10 | lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD))) 11 | 12 | -- Identifiers. 13 | lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word)) 14 | 15 | -- Strings. 16 | local sq_str = lexer.range("'") 17 | local dq_str = lexer.range('"') 18 | lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str)) 19 | 20 | -- Comments. 21 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('#'))) 22 | 23 | -- Numbers. 24 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number)) 25 | 26 | -- Operators. 27 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('+-*/%^=<>,.{}[]()'))) 28 | 29 | -- Fold points. 30 | lex:add_fold_point(lexer.KEYWORD, 'start', 'end') 31 | lex:add_fold_point(lexer.OPERATOR, '{', '}') 32 | 33 | -- Word lists. 34 | lex:set_word_list(lexer.KEYWORD, { 35 | 'keyword1', 'keyword2', 'keyword3' 36 | }) 37 | 38 | lexer.property['scintillua.comment'] = '#' 39 | 40 | return lex 41 | -------------------------------------------------------------------------------- /lua/lexers/tex.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Plain TeX LPeg lexer. 3 | -- Modified by Robert Gieseke. 4 | 5 | local lexer = lexer 6 | local P, S = lpeg.P, lpeg.S 7 | 8 | local lex = lexer.new(...) 9 | 10 | -- Comments. 11 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('%'))) 12 | 13 | -- TeX environments. 14 | lex:add_rule('environment', lex:tag('environment', '\\' * (P('begin') + 'end') * lexer.word)) 15 | 16 | -- Commands. 17 | lex:add_rule('command', lex:tag('command', '\\' * (lexer.alpha^1 + S('#$&~_^%{}')))) 18 | 19 | -- Operators. 20 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('$&#{}[]'))) 21 | 22 | -- Fold points. 23 | lex:add_fold_point('environment', '\\begin', '\\end') 24 | lex:add_fold_point(lexer.OPERATOR, '{', '}') 25 | 26 | lexer.property['scintillua.comment'] = '%' 27 | 28 | return lex 29 | -------------------------------------------------------------------------------- /lua/lexers/text.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2006-2025 Mitchell. See LICENSE. 2 | -- Text LPeg lexer. 3 | 4 | local lexer = require('lexer') 5 | 6 | local lex = lexer.new('text') 7 | 8 | lex:add_rule('whitespace', lexer.token(lexer.WHITESPACE, lexer.space^1)) 9 | 10 | lex:add_rule('text', lexer.token(lexer.DEFAULT, (1 - lexer.space)^1)) 11 | 12 | return lex 13 | -------------------------------------------------------------------------------- /lua/lexers/toml.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2015-2025 Alejandro Baez (https://keybase.io/baez). See LICENSE. 2 | -- TOML LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(..., {fold_by_indentation = true}) 8 | 9 | -- Keywords. 10 | lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lexer.word_match('true false'))) 11 | 12 | -- Identifiers. 13 | lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word)) 14 | 15 | -- Strings. 16 | local sq_str = lexer.range("'") 17 | local dq_str = lexer.range('"') 18 | lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str)) 19 | 20 | -- Comments. 21 | lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('#'))) 22 | 23 | -- Operators. 24 | lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('=+-,.{}[]()'))) 25 | 26 | -- Datetime. 27 | local year = lexer.digit * lexer.digit * lexer.digit * lexer.digit 28 | local month = lexer.digit * lexer.digit^-1 29 | local day = lexer.digit * lexer.digit^-1 30 | local date = year * '-' * month * '-' * day 31 | local hours = lexer.digit * lexer.digit^-1 32 | local minutes = lexer.digit * lexer.digit 33 | local seconds = lexer.digit * lexer.digit 34 | local fraction = '.' * lexer.digit^0 35 | local time = hours * ':' * minutes * ':' * seconds * fraction^-1 36 | local zone = 'Z' + S(' \t')^0 * S('-+') * hours * (':' * minutes)^-1 37 | lex:add_rule('datetime', lex:tag(lexer.NUMBER .. '.timestamp', date * (S('tT \t') * time * zone^-1))) 38 | 39 | -- Numbers. 40 | lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number)) 41 | 42 | lexer.property['scintillua.comment'] = '#' 43 | 44 | return lex 45 | -------------------------------------------------------------------------------- /lua/lexers/typescript.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2021-2025 Mitchell. See LICENSE. 2 | -- TypeScript LPeg lexer. 3 | 4 | local lexer = lexer 5 | local P, S = lpeg.P, lpeg.S 6 | 7 | local lex = lexer.new(..., {inherit = lexer.load('javascript')}) 8 | 9 | -- Word lists. 10 | lex:set_word_list(lexer.KEYWORD, 'abstract as constructor declare is module namespace require type', 11 | true) 12 | 13 | lex:set_word_list(lexer.TYPE, 'boolean number bigint string unknown any void never symbol object', 14 | true) 15 | 16 | lexer.property['scintillua.comment'] = '//' 17 | 18 | return lex 19 | -------------------------------------------------------------------------------- /lua/plugins/complete-word.lua: -------------------------------------------------------------------------------- 1 | -- complete word at primary selection location using vis-complete(1) 2 | 3 | vis:map(vis.modes.INSERT, "", function() 4 | local win = vis.win 5 | local file = win.file 6 | local pos = win.selection.pos 7 | if not pos then return end 8 | 9 | local range = file:text_object_word(pos > 0 and pos-1 or pos); 10 | if not range then return end 11 | if range.finish > pos then range.finish = pos end 12 | if range.start == range.finish then return end 13 | local prefix = file:content(range) 14 | if not prefix then return end 15 | 16 | vis:feedkeys("") 17 | -- collect words starting with prefix 18 | vis:command("x/\\b" .. prefix .. "\\w+/") 19 | local candidates = {} 20 | for sel in win:selections_iterator() do 21 | table.insert(candidates, file:content(sel.range)) 22 | end 23 | vis:feedkeys("") 24 | if #candidates == 1 and candidates[1] == "\n" then return end 25 | candidates = table.concat(candidates, "\n") 26 | 27 | local status, out, err = vis:pipe(candidates, "sort -u | vis-menu") 28 | if status ~= 0 or not out then 29 | if err then vis:info(err) end 30 | return 31 | end 32 | out = out:sub(#prefix + 1, #out - 1) 33 | file:insert(pos, out) 34 | win.selection.pos = pos + #out 35 | -- restore mode to what it was on entry 36 | vis.mode = vis.modes.INSERT 37 | end, "Complete word in file") 38 | -------------------------------------------------------------------------------- /lua/plugins/digraph.lua: -------------------------------------------------------------------------------- 1 | -- insert digraphs using vis-digraph(1) 2 | 3 | vis:map(vis.modes.INSERT, "", function(keys) 4 | if #keys < 2 then 5 | return -1 -- need more input 6 | end 7 | local file = io.popen(string.format("vis-digraph '%s' 2>&1", keys:gsub("'", "'\\''"))) 8 | local output = file:read('*all') 9 | local success, msg, status = file:close() 10 | if success then 11 | if vis.mode == vis.modes.INSERT then 12 | vis:insert(output) 13 | elseif vis.mode == vis.modes.REPLACE then 14 | vis:replace(output) 15 | end 16 | elseif msg == 'exit' then 17 | if status == 2 then 18 | return -1 -- prefix need more input 19 | end 20 | vis:info(output) 21 | end 22 | return #keys 23 | end, "Insert digraph") 24 | -------------------------------------------------------------------------------- /lua/plugins/textobject-lexer.lua: -------------------------------------------------------------------------------- 1 | -- text object matching a lexer token 2 | 3 | local MAX_CONTEXT = 32768 4 | 5 | vis:textobject_new("ii", function(win, pos) 6 | 7 | if not win.syntax or not vis.lexers.load then 8 | return nil 9 | end 10 | 11 | local lexer = vis.lexers.load(win.syntax, nil, true) 12 | if not lexer then 13 | return nil 14 | end 15 | 16 | local before, after = pos - MAX_CONTEXT, pos + MAX_CONTEXT 17 | if before < 0 then 18 | before = 0 19 | end 20 | -- TODO make sure we start at a line boundary? 21 | 22 | local data = win.file:content(before, after - before) 23 | local tokens = lexer:lex(data) 24 | local cur = before 25 | 26 | for i = 1, #tokens, 2 do 27 | local token_next = before + tokens[i+1] - 1 28 | if cur <= pos and pos < token_next then 29 | return cur, token_next 30 | end 31 | cur = token_next 32 | end 33 | 34 | return nil 35 | end, "Current lexer token") 36 | -------------------------------------------------------------------------------- /lua/themes/default.lua: -------------------------------------------------------------------------------- 1 | base-16.lua -------------------------------------------------------------------------------- /lua/visrc.lua: -------------------------------------------------------------------------------- 1 | -- load standard vis module, providing parts of the Lua API 2 | require('vis') 3 | 4 | vis.events.subscribe(vis.events.INIT, function() 5 | -- Your global configuration options 6 | end) 7 | 8 | vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args 9 | -- Your per window configuration options e.g. 10 | -- vis:command('set number') 11 | end) 12 | -------------------------------------------------------------------------------- /man/vis-digraph.1: -------------------------------------------------------------------------------- 1 | .Dd January 27, 2017 2 | .Dt VIS-DIGRAPH 1 3 | .Os Vis VERSION 4 | .Sh NAME 5 | .Nm vis-digraph 6 | .Nd print Unicode character using mnemonics 7 | . 8 | .Sh SYNOPSIS 9 | . 10 | .Nm 11 | .Ar digraph ... 12 | . 13 | .Nm 14 | .Fl 15 | . 16 | .Sh DESCRIPTION 17 | . 18 | .Nm vis-digraph 19 | read a digraph from command line argument or standard input and print 20 | a corresponding Unicode character to standard output, encoded in current 21 | locale. 22 | . 23 | .Bl -tag -width 8 24 | .It Ar digraph 25 | A set of two (or more) characters that get replaced by a single Unicode 26 | character. 27 | .It Fl 28 | Read digraph from standard input. 29 | .El 30 | .Pp 31 | Without argument, 32 | .Nm 33 | displays all available digraphs along with a description. 34 | . 35 | .Sh ENVIRONMENT 36 | . 37 | .Bl -tag -width 8 38 | . 39 | .It Ev LC_CTYPE 40 | Locale definition, setting the encoding format of the Unicode character printed out. 41 | See 42 | .Xr locale 1 43 | for more information. 44 | .El 45 | . 46 | .Sh EXIT STATUS 47 | . 48 | .Bl -tag -width 4 49 | .It 0 50 | Digraph correctly read recognised and printed out. 51 | .It 1 52 | Digraph not recognised. 53 | .It 2 54 | Digraph is the beginning of an existing digraph, but does not correspond to a full digraph. 55 | .It 3 56 | An error occurred and digraph could not be read or printed. 57 | .El 58 | . 59 | .Sh SEE ALSO 60 | . 61 | .Xr locale 1 , 62 | .Xr vis 1 63 | . 64 | .Sh STANDARDS 65 | . 66 | .Nm 67 | follows the digraph format from 68 | .Lk http://tools.ietf.org/rfc/rfc1345.txt "RFC 1345" 69 | -------------------------------------------------------------------------------- /sam.h: -------------------------------------------------------------------------------- 1 | #ifndef SAM_H 2 | #define SAM_H 3 | 4 | #include "vis.h" 5 | 6 | enum SamError { 7 | SAM_ERR_OK, 8 | SAM_ERR_MEMORY, 9 | SAM_ERR_ADDRESS, 10 | SAM_ERR_NO_ADDRESS, 11 | SAM_ERR_UNMATCHED_BRACE, 12 | SAM_ERR_REGEX, 13 | SAM_ERR_TEXT, 14 | SAM_ERR_SHELL, 15 | SAM_ERR_COMMAND, 16 | SAM_ERR_EXECUTE, 17 | SAM_ERR_NEWLINE, 18 | SAM_ERR_MARK, 19 | SAM_ERR_CONFLICT, 20 | SAM_ERR_WRITE_CONFLICT, 21 | SAM_ERR_LOOP_INVALID_CMD, 22 | SAM_ERR_GROUP_INVALID_CMD, 23 | SAM_ERR_COUNT, 24 | }; 25 | 26 | bool sam_init(Vis*); 27 | enum SamError sam_cmd(Vis*, const char *cmd); 28 | const char *sam_error(enum SamError); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.err 3 | *.status 4 | -------------------------------------------------------------------------------- /test/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright © 2014-2018 Marc André Tanner, et al. 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @$(MAKE) -C core 3 | @$(MAKE) -C lua 4 | @$(MAKE) -C vis 5 | @$(MAKE) -C sam 6 | @$(MAKE) -C vim 7 | 8 | clean: 9 | @$(MAKE) -C core clean 10 | @$(MAKE) -C lua clean 11 | @$(MAKE) -C vis clean 12 | @$(MAKE) -C sam clean 13 | @$(MAKE) -C vim clean 14 | @$(MAKE) -C util clean 15 | 16 | .PHONY: test clean 17 | -------------------------------------------------------------------------------- /test/core/.gitignore: -------------------------------------------------------------------------------- 1 | *.gcda 2 | *.gcno 3 | *.gcov 4 | *.valgrind 5 | /array-test 6 | /buffer-test 7 | /ccan-config 8 | /config.h 9 | /data 10 | /hardlink 11 | /map-test 12 | /symlink 13 | /text-test 14 | -------------------------------------------------------------------------------- /test/core/README.md: -------------------------------------------------------------------------------- 1 | Unit tests for the low level routines used by vis 2 | ------------------------------------------------- 3 | 4 | The testing infrastruce makes use of the tap module from the 5 | [C Code Archive](http://ccodearchive.net). 6 | 7 | To run the tests, execute `make`. 8 | 9 | $ make 10 | -------------------------------------------------------------------------------- /test/core/ccan/compiler/LICENSE: -------------------------------------------------------------------------------- 1 | ../../licenses/CC0 -------------------------------------------------------------------------------- /test/core/ccan/compiler/test/compile_fail-printf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void PRINTF_FMT(2,3) my_printf(int x, const char *fmt, ...) 4 | { 5 | } 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | unsigned int i = 0; 10 | 11 | my_printf(1, "Not a pointer " 12 | #ifdef FAIL 13 | "%p", 14 | #if !HAVE_ATTRIBUTE_PRINTF 15 | #error "Unfortunately we don't fail if !HAVE_ATTRIBUTE_PRINTF." 16 | #endif 17 | #else 18 | "%i", 19 | #endif 20 | i); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /test/core/ccan/compiler/test/run-is_compile_constant.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | plan_tests(2); 7 | 8 | ok1(!IS_COMPILE_CONSTANT(argc)); 9 | #if HAVE_BUILTIN_CONSTANT_P 10 | ok1(IS_COMPILE_CONSTANT(7)); 11 | #else 12 | pass("If !HAVE_BUILTIN_CONSTANT_P, IS_COMPILE_CONSTANT always false"); 13 | #endif 14 | return exit_status(); 15 | } 16 | -------------------------------------------------------------------------------- /test/core/tap.h: -------------------------------------------------------------------------------- 1 | #ifndef TAP_H 2 | #define TAP_H 3 | 4 | #ifdef TIS_INTERPRETER 5 | static int failures = 0; 6 | static int test_count = 0; 7 | static void plan_no_plan(void) { } 8 | 9 | static int exit_status() { 10 | if (failures > 255) 11 | failures = 255; 12 | return failures; 13 | } 14 | 15 | #define ok(e, ...) do { \ 16 | bool _e = (e); \ 17 | printf("%sok %d - ", _e ? "" : "not ", ++test_count); \ 18 | printf(__VA_ARGS__); \ 19 | printf("\n"); \ 20 | if (!_e) { \ 21 | failures++; \ 22 | printf(" Failed test (%s:%s() at line %d)\n", __FILE__, __func__, __LINE__); \ 23 | } \ 24 | } while (0) 25 | 26 | #define skip_if(cond, n, ...) \ 27 | if (cond) skip((n), __VA_ARGS__); \ 28 | else 29 | 30 | #define skip(n, ...) do { \ 31 | int _n = (n); \ 32 | while (_n--) { \ 33 | printf("ok %d # skip ", ++test_count); \ 34 | printf(__VA_ARGS__); \ 35 | printf("\n"); \ 36 | } \ 37 | } while (0) 38 | 39 | #include 40 | time_t time(time_t *p) 41 | { 42 | static time_t value; 43 | value++; 44 | if (p) *p = value; 45 | return value; 46 | } 47 | 48 | long labs(long v) 49 | { 50 | return v > 0 ? v : -v; 51 | } 52 | 53 | #else 54 | #include 55 | #define TIS_INTERPRETER 0 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /test/fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | /results 2 | /text-fuzzer 3 | /text-libfuzzer 4 | /buffer-fuzzer 5 | -------------------------------------------------------------------------------- /test/fuzz/README.md: -------------------------------------------------------------------------------- 1 | Fuzzing infrastructure for low level code used by vis 2 | ----------------------------------------------------- 3 | 4 | This directory contains some simple command line applications 5 | which expose core library interfaces through the standard I/O 6 | streams. They are intended to be used as test drivers for 7 | fuzzers like [AFL](http://lcamtuf.coredump.cx/afl/). 8 | 9 | Run one of the `make afl-fuzz-*` targets to start fuzzing a 10 | specific instrumented binary using `afl-fuzz(1)`. By default 11 | it will try to resume a previous fuzzing session, before 12 | starting a new one if that fails. 13 | 14 | The following files are used: 15 | 16 | * `$APP-fuzzer.c` application exposing a simple text interface 17 | * `fuzzer.h` common code used among different fuzzing drivers 18 | * `./input/$APP/` intial test input, one file per test 19 | * `./dictionaries/$APP.dict` a dictionary with valid syntax tokens 20 | * `./results/$APP/` the fuzzing results are stored here 21 | 22 | See the AFL documentation for further information. 23 | 24 | In the future we might also use [libFuzzer](http://llvm.org/docs/LibFuzzer.html) 25 | for further fuzzing. 26 | 27 | Quick start example: 28 | 29 | $ make afl-fuzz-text 30 | 31 | -------------------------------------------------------------------------------- /test/fuzz/dictionaries/buffer-fuzzer.dict: -------------------------------------------------------------------------------- 1 | # AFL dictionary for buffer-fuzzer 2 | # 3 | # Not sure whether it makes sense to specify a dictionary, 4 | # the syntax is quite simple? 5 | # 6 | cmd_capacity="?" 7 | cmd_set="=" 8 | cmd_size="#" 9 | cmd_clear="c" 10 | # cmd_delete="d 0 1" 11 | cmd_delete="d" 12 | # cmd_insert="i 0 text" 13 | cmd_insert="i" 14 | cmd_print="p" 15 | cmd_quit="q" 16 | -------------------------------------------------------------------------------- /test/fuzz/dictionaries/text-fuzzer.dict: -------------------------------------------------------------------------------- 1 | # AFL dictionary for text-fuzzer 2 | # 3 | # Not sure whether it makes sense to specify a dictionary, 4 | # the syntax is quite simple? 5 | # 6 | cmd_earlier="-" 7 | cmd_later="+" 8 | cmd_mark_get="?" 9 | # cmd_mark_set="= 0" 10 | cmd_mark_set="=" 11 | cmd_size="#" 12 | # cmd_delete="d 0 1" 13 | cmd_delete="d" 14 | # cmd_insert="i 0 text" 15 | cmd_insert="i" 16 | cmd_print="p" 17 | cmd_quit="q" 18 | cmd_redo="r" 19 | cmd_snapshot="s" 20 | cmd_undo="u" 21 | -------------------------------------------------------------------------------- /test/fuzz/dictionaries/text-libfuzzer.dict: -------------------------------------------------------------------------------- 1 | text-fuzzer.dict -------------------------------------------------------------------------------- /test/fuzz/fuzzer.h: -------------------------------------------------------------------------------- 1 | #ifndef FUZZER_H 2 | #define FUZZER_H 3 | 4 | enum CmdStatus { 5 | CMD_FAIL = false, 6 | CMD_OK = true, 7 | CMD_ERR, /* syntax error */ 8 | CMD_QUIT, /* quit, accept no further commands */ 9 | }; 10 | 11 | static const char *cmd_status_msg[] = { 12 | [CMD_FAIL] = "Fail\n", 13 | [CMD_OK] = "", 14 | [CMD_ERR] = "Syntax error\n", 15 | [CMD_QUIT] = "Bye\n", 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /test/fuzz/inputs/buffer-fuzzer/buffer-fuzzer.in: -------------------------------------------------------------------------------- 1 | i 0 text 2 | d 1 2 3 | p 4 | i 1 ex 5 | p 6 | = data 7 | p 8 | c 9 | q 10 | -------------------------------------------------------------------------------- /test/fuzz/inputs/text-fuzzer/text-fuzzer.in: -------------------------------------------------------------------------------- 1 | i 0 text 2 | d 1 2 3 | s 4 | i 1 ex 5 | u 6 | r 7 | - 8 | + 9 | p 10 | # 11 | = 2 12 | ? 13 | q 14 | -------------------------------------------------------------------------------- /test/fuzz/inputs/text-libfuzzer/text-libfuzzer.in: -------------------------------------------------------------------------------- 1 | ../text-fuzzer/text-fuzzer.in -------------------------------------------------------------------------------- /test/lua/Makefile: -------------------------------------------------------------------------------- 1 | all: clean ../../vis test 2 | 3 | ../../vis: ../../*.[ch] 4 | @echo Compiling vis 5 | @$(MAKE) -C ../.. 6 | 7 | clean: 8 | @rm -f *.out *.err 9 | 10 | test: 11 | @./test.sh 12 | 13 | %: %.in 14 | @./test.sh $@ 15 | 16 | .PHONY: all clean test 17 | -------------------------------------------------------------------------------- /test/lua/README.md: -------------------------------------------------------------------------------- 1 | Unit Test for Vis' Lua API 2 | -------------------------- 3 | 4 | The test-suite is based on the [busted][] unit testing framework. 5 | 6 | Each `*.lua` file is sourced from a new `vis` instance which loads the 7 | correspending `*.in` file. 8 | 9 | Use the `test.sh` shell script to run an individual test or type `make` 10 | to run all tests. 11 | 12 | [busted]: https://lunarmodules.github.io/busted 13 | -------------------------------------------------------------------------------- /test/lua/cursor.in: -------------------------------------------------------------------------------- 1 | 1: abc 2 | 2: def 3 | 3: ghi 4 | 4: jkl 5 | 5: mno 6 | 6: pqr 7 | 7: stu 8 | 8: vwx 9 | 9: yz_ 10 | -------------------------------------------------------------------------------- /test/lua/file-empty.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martanne/vis/bef2261962ca3636531957baf0abe1503f8c4f97/test/lua/file-empty.in -------------------------------------------------------------------------------- /test/lua/file-empty.lua: -------------------------------------------------------------------------------- 1 | 2 | local file = vis.win.file 3 | 4 | describe("empty file", function() 5 | 6 | it("has size zero", function() 7 | assert.are.equal(0, file.size) 8 | end) 9 | 10 | it("has zero lines", function() 11 | assert.are.equal(0, #file.lines) 12 | end) 13 | 14 | it("has lines[1] == ''", function() 15 | -- is that what we want? 16 | assert.are.equal("", file.lines[1]) 17 | end) 18 | 19 | end) 20 | 21 | -------------------------------------------------------------------------------- /test/lua/lines.in: -------------------------------------------------------------------------------- 1 | 1 2 | 3 | 3 4 | 5 | 5 6 | -------------------------------------------------------------------------------- /test/lua/map-basic.lua: -------------------------------------------------------------------------------- 1 | 2 | vis:map(vis.modes.NORMAL, "K", function() 3 | vis:feedkeys("iNormal Mode") 4 | end) 5 | 6 | vis:map(vis.modes.INSERT, "K", function() 7 | vis:feedkeys("Insert Mode") 8 | end) 9 | 10 | vis:map(vis.modes.VISUAL, "K", function() 11 | vis:feedkeys("iVisual Mode") 12 | end) 13 | 14 | vis:map(vis.modes.VISUAL_LINE, "K", function() 15 | vis:feedkeys("iVisual Line Mode") 16 | end) 17 | 18 | vis:map(vis.modes.REPLACE, "K", function() 19 | vis:feedkeys("Replace Mode") 20 | end) 21 | 22 | local win = vis.win 23 | local file = win.file 24 | 25 | describe("map", function() 26 | 27 | before_each(function() 28 | win.selection.pos = 0 29 | end) 30 | 31 | after_each(function() 32 | file:delete(0, file.size) 33 | end) 34 | 35 | local same = function(expected) 36 | local data = file:content(0, file.size) 37 | assert.are.same(expected, data) 38 | end 39 | 40 | it("normal mode", function() 41 | vis:feedkeys("K") 42 | same("Normal Mode") 43 | end) 44 | 45 | it("insert mode", function() 46 | vis:feedkeys("iK") 47 | same("Insert Mode") 48 | end) 49 | 50 | it("visual mode", function() 51 | vis:feedkeys("vK") 52 | same("Visual Mode") 53 | end) 54 | 55 | it("visual line mode", function() 56 | vis:feedkeys("VK") 57 | same("Visual Line Mode") 58 | end) 59 | 60 | it("replace mode", function() 61 | vis:feedkeys("RK") 62 | same("Replace Mode") 63 | end) 64 | end) 65 | -------------------------------------------------------------------------------- /test/lua/pipe.in: -------------------------------------------------------------------------------- 1 | foo -------------------------------------------------------------------------------- /test/lua/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export VIS_PATH=. 4 | [ -z "$VIS" ] && VIS="../../vis" 5 | $VIS -v 6 | 7 | if ! $VIS -v | grep '+lua' >/dev/null 2>&1; then 8 | echo "vis compiled without lua support, skipping tests" 9 | exit 0 10 | fi 11 | 12 | TESTS_OK=0 13 | TESTS_RUN=0 14 | 15 | if [ $# -gt 0 ]; then 16 | test_files=$* 17 | else 18 | test_files="$(find . -type f -name '*.lua' -a ! -name visrc.lua)" 19 | fi 20 | 21 | for t in $test_files; do 22 | TESTS_RUN=$((TESTS_RUN + 1)) 23 | t=${t%.lua} 24 | t=${t#./} 25 | printf "%-30s" "$t" 26 | $VIS "$t.in" < /dev/null 2> /dev/null > "$t.out" 27 | 28 | if [ $? -ne 0 ]; then 29 | printf "FAIL\n" 30 | cat "$t.out" 31 | else 32 | TESTS_OK=$((TESTS_OK + 1)) 33 | printf "OK\n" 34 | fi 35 | done 36 | 37 | printf "Tests ok %d/%d\n" $TESTS_OK $TESTS_RUN 38 | 39 | # set exit status 40 | [ $TESTS_OK -eq $TESTS_RUN ] 41 | -------------------------------------------------------------------------------- /test/sam/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.err 3 | *.disabled -------------------------------------------------------------------------------- /test/sam/Makefile: -------------------------------------------------------------------------------- 1 | test: ../../vis 2 | @./test.sh 3 | 4 | ../../vis: ../../*.[ch] 5 | @echo Compiling vis 6 | @$(MAKE) -C ../.. 7 | 8 | clean: 9 | @echo cleaning 10 | @find . -name '*.out' -o -name '*.err' | xargs rm -f 11 | 12 | .PHONY: clean test 13 | -------------------------------------------------------------------------------- /test/sam/addresses/columns.cmd: -------------------------------------------------------------------------------- 1 | ,x/def|uvw/ { 2 | g/def/ -/^/+#10 i/|/ 3 | g/uvw/ +/$/-#10 i/|/ 4 | } 5 | -------------------------------------------------------------------------------- /test/sam/addresses/columns.in: -------------------------------------------------------------------------------- 1 | -- 2 | abcdefghijklmnopqrstuvwxyz 3 | -- 4 | abcdefghijklmnopqrstuvwxyz 5 | -- 6 | -------------------------------------------------------------------------------- /test/sam/addresses/first-last.cmd: -------------------------------------------------------------------------------- 1 | 0/Emacs/,$-/Emacs/ { 2 | i/>>/ 3 | a/</ 5 | } 6 | 20d 7 | -------------------------------------------------------------------------------- /test/sam/addresses/lines.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | 11 12 | 12 13 | 13 14 | 14 15 | 15 16 | 16 17 | 17 18 | 18 19 | 19 20 | 20 21 | -------------------------------------------------------------------------------- /test/sam/addresses/second.cmd: -------------------------------------------------------------------------------- 1 | 0/Emacs/+// { 2 | i/>>/ 3 | a/< cat > pipe-out.tmp 2 | 0 < cat pipe-out.tmp 3 | 0 r pipe-out.tmp 4 | ! rm pipe-out.tmp 5 | 0 < cat pipe-out.tmp 6 | -------------------------------------------------------------------------------- /test/sam/commands/pipe-out.in: -------------------------------------------------------------------------------- 1 | Hello World 2 | -------------------------------------------------------------------------------- /test/sam/commands/repeated-shell.cmd: -------------------------------------------------------------------------------- 1 | 1 | tr a-z A-Z 2 | 2 | 3 | -------------------------------------------------------------------------------- /test/sam/commands/repeated-shell.in: -------------------------------------------------------------------------------- 1 | Hello 2 | World 3 | -------------------------------------------------------------------------------- /test/sam/commands/unicode-replace.cmd: -------------------------------------------------------------------------------- 1 | x/♪/ c/♫/ 2 | -------------------------------------------------------------------------------- /test/sam/commands/unicode-replace.in: -------------------------------------------------------------------------------- 1 | ♪ 2 | ♪♪ 3 | ♪♪♪ 4 | ♪♪ 5 | ♪ 6 | -------------------------------------------------------------------------------- /test/sam/errors/conflict.cmd: -------------------------------------------------------------------------------- 1 | ,{ 2 | c/text1/ 3 | c/text2/ 4 | } 5 | -------------------------------------------------------------------------------- /test/sam/errors/conflict.in: -------------------------------------------------------------------------------- 1 | Hello World! 2 | -------------------------------------------------------------------------------- /test/sam/errors/read.cmd: -------------------------------------------------------------------------------- 1 | 1 r not-found 2 | -------------------------------------------------------------------------------- /test/sam/errors/read.in: -------------------------------------------------------------------------------- 1 | Read non-existing file 2 | -------------------------------------------------------------------------------- /test/sam/errors/unbalanced-group.cmd: -------------------------------------------------------------------------------- 1 | { 2 | i/>/ 3 | { 4 | a/ /* search for # */ 3 | jyypjdd /* move down, yank, put, delete line below */ 4 | q /* stop macro recording */ 5 | @a /* replay macro */ 6 | @@ /* replay again */ 7 | -------------------------------------------------------------------------------- /test/vim/golf/4d1a34ccfa85f32065000004/1.ref: -------------------------------------------------------------------------------- 1 | Make the pairs of lines match up by making each second line same as first: 2 | 3 | # Appending text: 4 | The name "Vim" is an acronym for "Vi IMproved" 5 | The name "Vim" is an acronym for "Vi IMproved" 6 | 7 | # Editing text: 8 | Vim is a text editor originally released by Bram Moolenaar in 1991 for the Amiga 9 | Vim is a text editor originally released by Bram Moolenaar in 1991 for the Amiga 10 | 11 | # Deleting text: 12 | Vim has a vi compatibility mode 13 | Vim has a vi compatibility mode 14 | -------------------------------------------------------------------------------- /test/vim/golf/4d1ac1800a045132c0000011/1.in: -------------------------------------------------------------------------------- 1 | #include 2 | int main(void){puts("Hello world!");return 0;} 3 | -------------------------------------------------------------------------------- /test/vim/golf/4d1ac1800a045132c0000011/1.keys: -------------------------------------------------------------------------------- 1 | f /* move to first < and insert space */ 2 | o /* insert new line */ 3 | jf{i /* insert new line before { */ 4 | w. /* repeat to insert new line before puts */ 5 | f;a /* insert new line after ; */ 6 | ;. /* repeat last f search, repeat append */ 7 | ki /* move line up, insert space */ 8 | 3. /* insert 3 more spaces (TODO: implement [count]i ?) */ 9 | k^4. /* move line up, insert 4 spaces */ -------------------------------------------------------------------------------- /test/vim/golf/4d1ac1800a045132c0000011/1.ref: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | puts("Hello world!"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /test/vim/golf/4d665abd7d73e02a55000009/1.in: -------------------------------------------------------------------------------- 1 | List c = new ArrayList(); 2 | 112.2), 102), 12), 954), 39.43), 49.4), 2224.6), 94), 123), 4929.55), 12), 98), 91.22) 3 | }; 4 | -------------------------------------------------------------------------------- /test/vim/golf/4d665abd7d73e02a55000009/1.keys.broken: -------------------------------------------------------------------------------- 1 | iList< /* insert List< */ 2 | ~ /* upper case d to D */ 3 | yiw /* yank Double */ 4 | wx /* delete [ */ 5 | r> /* overwrite ] with > */ 6 | A new ArrayList<>(); /* append text */ 7 | F< /* find backwards */ 8 | "0p 9 | /* paste from yank register */ 10 | jdd /* delete { line */ 11 | 3J /* join data on single line */ 12 | qa /* start macro recording */ 13 | f,i) /* insert ) before comma */ 14 | q /* stop macro recording */ 15 | @a /* replay macro */ 16 | @@@@@@@@@@@@@@ /* again (TODO: count for macro replay, make @ repeatable) */ 17 | -------------------------------------------------------------------------------- /test/vim/golf/4d665abd7d73e02a55000009/1.ref: -------------------------------------------------------------------------------- 1 | List c = new ArrayList(); 2 | c.add(112.2); 3 | c.add(102d); 4 | c.add(12d); 5 | c.add(954d); 6 | c.add(39.43); 7 | c.add(49.4); 8 | c.add(2224.6); 9 | c.add(94d); 10 | c.add(123d); 11 | c.add(4929.55); 12 | c.add(12d); 13 | c.add(98d); 14 | c.add(91.22); 15 | -------------------------------------------------------------------------------- /test/vim/golf/4ddbd92898957e0001000016/1.in: -------------------------------------------------------------------------------- 1 | China,1,2,3,4,5,6 2 | Brazil,3,1,2,5,5,6 3 | SAD,9,2,3,4,5,6 4 | UK,3,8,3,9,5,1 5 | France,7,2,3,4,5,6 6 | Germany,1,7,3,2,5,6 7 | Russia,1,6,2,9,5,6 8 | Spain,1,2,2,4,5,6 9 | Greece,1,3,3,4,5,6 10 | India,4,2,3,4,5,6 11 | Turkey,1,2,3,4,5,9 12 | Poland,1,2,3,4,5,6 13 | China,1,2,3,8,5,6 14 | Brazil,1,2,3,4,5,6 15 | SAD,1,2,3,4,5,6 16 | UK,1,2,3,4,5,6 17 | France,1,2,3,4,5,6 18 | Germany,1,2,3,4,5,6 19 | Russia,1,2,7,4,5,6 20 | Spain,1,2,3,4,5,6 21 | Greece,1,2,2,4,5,6 22 | India,1,2,8,4,5,6 23 | Turkey,1,2,1,7,5,6 24 | Poland,2,2,3,9,5,6 25 | -------------------------------------------------------------------------------- /test/vim/golf/4ddbd92898957e0001000016/1.keys: -------------------------------------------------------------------------------- 1 | qq /* start macro recording */ 2 | * /* search word under cursor */ 3 | dd /* delete line */ 4 | N /* repeat search */ 5 | P /* put before */ 6 | 2j /* 2 lines down */ 7 | q /* stop macro recording */ 8 | 11@q /* repeat macro 11 times */ 9 | -------------------------------------------------------------------------------- /test/vim/golf/4ddbd92898957e0001000016/1.ref: -------------------------------------------------------------------------------- 1 | China,1,2,3,8,5,6 2 | China,1,2,3,4,5,6 3 | Brazil,1,2,3,4,5,6 4 | Brazil,3,1,2,5,5,6 5 | SAD,1,2,3,4,5,6 6 | SAD,9,2,3,4,5,6 7 | UK,1,2,3,4,5,6 8 | UK,3,8,3,9,5,1 9 | France,1,2,3,4,5,6 10 | France,7,2,3,4,5,6 11 | Germany,1,2,3,4,5,6 12 | Germany,1,7,3,2,5,6 13 | Russia,1,2,7,4,5,6 14 | Russia,1,6,2,9,5,6 15 | Spain,1,2,3,4,5,6 16 | Spain,1,2,2,4,5,6 17 | Greece,1,2,2,4,5,6 18 | Greece,1,3,3,4,5,6 19 | India,1,2,8,4,5,6 20 | India,4,2,3,4,5,6 21 | Turkey,1,2,1,7,5,6 22 | Turkey,1,2,3,4,5,9 23 | Poland,2,2,3,9,5,6 24 | Poland,1,2,3,4,5,6 25 | -------------------------------------------------------------------------------- /test/vim/golf/4e31627b74ab580001000007/1.disabled: -------------------------------------------------------------------------------- 1 | dd 2 | ipublic 3 | :%s,\$this->,,g /* we use , as delimiter because // interferes with the CPP */ 4 | :%s,\$,,g 5 | :%s,private var,private double var, 6 | /sqrt 7 | iMath. 8 | gg 9 | /function 10 | dw 11 | n 12 | cwvoid 13 | n 14 | . 15 | n 16 | cwdouble 17 | gg 18 | /val 19 | idouble /* in vim moves the cursor 1 cell back, hence 2n will not do the right thing */ 20 | fv /* accounts for this cursor is now at the start of "val" */ 21 | 2n. 22 | Gdd 23 | -------------------------------------------------------------------------------- /test/vim/golf/4e31627b74ab580001000007/1.in: -------------------------------------------------------------------------------- 1 | init($val); 10 | $this->doSomething(); 11 | } 12 | 13 | private function init($val) 14 | { 15 | $this->var1 = $val; 16 | } 17 | 18 | private function doSomething() 19 | { 20 | $this->var2 = sqrt($this->var1); 21 | } 22 | 23 | public function getResult() 24 | { 25 | return $this->var2; 26 | } 27 | } 28 | ?> 29 | -------------------------------------------------------------------------------- /test/vim/golf/4e31627b74ab580001000007/1.ref: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | private double var1; 4 | private double var2; 5 | 6 | public Foo(double val) 7 | { 8 | init(val); 9 | doSomething(); 10 | } 11 | 12 | private void init(double val) 13 | { 14 | var1 = val; 15 | } 16 | 17 | private void doSomething() 18 | { 19 | var2 = Math.sqrt(var1); 20 | } 21 | 22 | public double getResult() 23 | { 24 | return var2; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/vim/golf/4ef209ef78702b0001000019/1.in: -------------------------------------------------------------------------------- 1 | #Set the global prefix key to C-q (default is C-b) 2 | set-option -g prefix C-q 3 | bind-key C-q last-window 4 | # Remove default binding since we’re replacing 5 | unbind % 6 | bind | split-window -h 7 | bind - split-window -v 8 | # Set status bar 9 | set -g status-bg black 10 | set -g status-fg white 11 | set -g status-left '#[fg=green]#H' 12 | # Highlight active window 13 | set-window-option -g window-status-current-bg red 14 | set -g status-right '#[fg=yellow]#(uptime | cut -d "," -f 2-)' 15 | # Set window notifications 16 | setw -g monitor-activity on 17 | set -g visual-activity on 18 | # Automatically set window title 19 | setw -g automatic-rename 20 | -------------------------------------------------------------------------------- /test/vim/golf/4ef209ef78702b0001000019/1.keys: -------------------------------------------------------------------------------- 1 | /# 2 | O 3 | 2n. 4 | 2n. 5 | 2n. 6 | 2n. 7 | -------------------------------------------------------------------------------- /test/vim/golf/4ef209ef78702b0001000019/1.ref: -------------------------------------------------------------------------------- 1 | #Set the global prefix key to C-q (default is C-b) 2 | set-option -g prefix C-q 3 | bind-key C-q last-window 4 | 5 | 6 | # Remove default binding since we’re replacing 7 | unbind % 8 | bind | split-window -h 9 | bind - split-window -v 10 | 11 | 12 | # Set status bar 13 | set -g status-bg black 14 | set -g status-fg white 15 | set -g status-left '#[fg=green]#H' 16 | 17 | 18 | # Highlight active window 19 | set-window-option -g window-status-current-bg red 20 | set -g status-right '#[fg=yellow]#(uptime | cut -d "," -f 2-)' 21 | 22 | 23 | # Set window notifications 24 | setw -g monitor-activity on 25 | set -g visual-activity on 26 | 27 | 28 | # Automatically set window title 29 | setw -g automatic-rename 30 | -------------------------------------------------------------------------------- /test/vim/golf/4fbf8e303be58b0001000024/1.in: -------------------------------------------------------------------------------- 1 | {Vertex('x'): {Vertex('v'): Edge(Vertex('v'), Vertex('x')), Vertex('z'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('y'), Vertex('x'))}, Vertex('y'): {Vertex('x'): Edge(Vertex('y'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('y')), Vertex('z'): Edge(Vertex('z'), Vertex('y'))}, Vertex('z'): {Vertex('x'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('z'), Vertex('y')), Vertex('u'): Edge(Vertex('u'), Vertex('z'))}, Vertex('u'): {Vertex('v'): Edge(Vertex('v'), Vertex('u')), Vertex('w'): Edge(Vertex('w'), Vertex('u')), Vertex('z'): Edge(Vertex('u'), Vertex('z'))}, Vertex('v'): {Vertex('u'): Edge(Vertex('v'), Vertex('u')), Vertex('x'): Edge(Vertex('v'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('v'))}, Vertex('w'): {Vertex('u'): Edge(Vertex('w'), Vertex('u')), Vertex('v'): Edge(Vertex('w'), Vertex('v')), Vertex('y'): Edge(Vertex('w'), Vertex('y'))}} 2 | -------------------------------------------------------------------------------- /test/vim/golf/4fbf8e303be58b0001000024/1.keys: -------------------------------------------------------------------------------- 1 | a /* line break after {, indent following line with 2 spaces */ 2 | qq /* start macro recording */ 3 | f{a /* line break after {, indent following line with 4 spaces */ 4 | 2f,l. 5 | 2;l. 6 | t}a 7 | e.x 8 | q 9 | @q 10 | 4@@ 11 | gg /* go to very first { of file */ 12 | % /* go to matching bracket at end of file */ 13 | i /* move it to a new line */ 14 | jdd /* delete last line of file */ 15 | -------------------------------------------------------------------------------- /test/vim/golf/4fbf8e303be58b0001000024/1.ref: -------------------------------------------------------------------------------- 1 | { 2 | Vertex('x'): { 3 | Vertex('v'): Edge(Vertex('v'), Vertex('x')), 4 | Vertex('z'): Edge(Vertex('z'), Vertex('x')), 5 | Vertex('y'): Edge(Vertex('y'), Vertex('x')) 6 | }, 7 | Vertex('y'): { 8 | Vertex('x'): Edge(Vertex('y'), Vertex('x')), 9 | Vertex('w'): Edge(Vertex('w'), Vertex('y')), 10 | Vertex('z'): Edge(Vertex('z'), Vertex('y')) 11 | }, 12 | Vertex('z'): { 13 | Vertex('x'): Edge(Vertex('z'), Vertex('x')), 14 | Vertex('y'): Edge(Vertex('z'), Vertex('y')), 15 | Vertex('u'): Edge(Vertex('u'), Vertex('z')) 16 | }, 17 | Vertex('u'): { 18 | Vertex('v'): Edge(Vertex('v'), Vertex('u')), 19 | Vertex('w'): Edge(Vertex('w'), Vertex('u')), 20 | Vertex('z'): Edge(Vertex('u'), Vertex('z')) 21 | }, 22 | Vertex('v'): { 23 | Vertex('u'): Edge(Vertex('v'), Vertex('u')), 24 | Vertex('x'): Edge(Vertex('v'), Vertex('x')), 25 | Vertex('w'): Edge(Vertex('w'), Vertex('v')) 26 | }, 27 | Vertex('w'): { 28 | Vertex('u'): Edge(Vertex('w'), Vertex('u')), 29 | Vertex('v'): Edge(Vertex('w'), Vertex('v')), 30 | Vertex('y'): Edge(Vertex('w'), Vertex('y')) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/vim/golf/50ad2cb165b8db0002000029/1.in: -------------------------------------------------------------------------------- 1 | > "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium 2 | > doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore 3 | > veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim 4 | > ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit. 5 | 6 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor 7 | incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis 8 | nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 9 | 10 | > Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi 11 | > nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, 12 | > consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt 13 | > ut labore et dolore magnam aliquam quaerat voluptatem. 14 | 15 | Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit 16 | laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure 17 | reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, 18 | vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?" 19 | -------------------------------------------------------------------------------- /test/vim/golf/50ad2cb165b8db0002000029/1.keys: -------------------------------------------------------------------------------- 1 | /> 2 | dw 3 | n. 4 | n. 5 | 2n. 6 | n. 7 | n. 8 | gg 9 | 4J 10 | }j3J 11 | }j4J 12 | }j. 13 | -------------------------------------------------------------------------------- /test/vim/golf/50ad2cb165b8db0002000029/1.ref: -------------------------------------------------------------------------------- 1 | > "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit. 2 | 3 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 4 | 5 | > Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. 6 | 7 | Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?" 8 | -------------------------------------------------------------------------------- /test/vim/golf/50b1d7239aad89000200002d/1.in: -------------------------------------------------------------------------------- 1 | 2 | txt123 3 | 4 | 5 | txt127 6 | txt137 7 | 8 | txt148 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/vim/golf/50b1d7239aad89000200002d/1.ref: -------------------------------------------------------------------------------- 1 | ^(txt123|txt127|txt137|txt148).*$ 2 | -------------------------------------------------------------------------------- /test/vim/golf/50c13afab855760002000049/1.in: -------------------------------------------------------------------------------- 1 | a b c d e f g h i j k l m n o p q r s t u v w x y z 2 | a b c d e f g h i j k l m n o p q r s t u v w x y z 3 | a b c d e f g h i j k l m n o p q r s t u v w x y z 4 | a b c d e f g h i j k l m n o p q r s t u v w x y z 5 | a b c d e f g h i j k l m n o p q r s t u v w x y z 6 | a b c d e f g h i j k l m n o p q r s t u v w x y z 7 | a b c d e f g h i j k l m n o p q r s t u v w x y z 8 | a b c d e f g h i j k l m n o p q r s t u v w x y z 9 | a b c d e f g h i j k l m n o p q r s t u v w x y z 10 | a b c d e f g h i j k l m n o p q r s t u v w x y z 11 | a b c d e f g h i j k l m n o p q r s t u v w x y z 12 | a b c d e f g h i j k l m n o p q r s t u v w x y z 13 | a b c d e f g h i j k l m n o p q r s t u v w x y z 14 | a b c d e f g h i j k l m n o p q r s t u v w x y z 15 | a b c d e f g h i j k l m n o p q r s t u v w x y z 16 | a b c d e f g h i j k l m n o p q r s t u v w x y z 17 | a b c d e f g h i j k l m n o p q r s t u v w x y z 18 | a b c d e f g h i j k l m n o p q r s t u v w x y z 19 | a b c d e f g h i j k l m n o p q r s t u v w x y z 20 | a b c d e f g h i j k l m n o p q r s t u v w x y z 21 | a b c d e f g h i j k l m n o p q r s t u v w x y z 22 | a b c d e f g h i j k l m n o p q r s t u v w x y z 23 | a b c d e f g h i j k l m n o p q r s t u v w x y z 24 | a b c d e f g h i j k l m n o p q r s t u v w x y z 25 | -------------------------------------------------------------------------------- /test/vim/golf/50c18a08b855760002000056/1.keys.broken: -------------------------------------------------------------------------------- 1 | j 2 | VGI 3 | e 4 | a 5 | dw 6 | e 7 | a 8 | dw -------------------------------------------------------------------------------- /test/vim/golf/50c2c246b0544c000200003f/1.in: -------------------------------------------------------------------------------- 1 | 01234567890123456789012345678901234567890123456789012345678901234567890123456789 2 | 1 0 3 | 2 1 4 | 3 2 5 | 4 3 6 | 5 4 7 | 6 5 8 | 7 6 9 | 8 7 10 | 9 8 11 | 01234567890123456789012345678901234567890123456789012345678901234567890123456789 12 | -------------------------------------------------------------------------------- /test/vim/golf/50c2c246b0544c000200003f/1.ref: -------------------------------------------------------------------------------- 1 | 01234567890123456789012345678901234567890123456789012345678901234567890123456789 2 | 1 0 0 0 0 0 0 0 0 3 | 2 1 1 1 1 1 1 1 1 4 | 3 2 2 2 2 2 2 2 2 5 | 4 3 3 3 3 3 3 3 3 6 | 5 4 4 4 4 4 4 4 4 7 | 6 5 5 5 5 5 5 5 5 8 | 7 6 6 6 6 6 6 6 6 9 | 8 7 7 7 7 7 7 7 7 10 | 9 8 8 8 8 8 8 8 8 11 | 01234567890123456789012345678901234567890123456789012345678901234567890123456789 12 | -------------------------------------------------------------------------------- /test/vim/golf/50d0c33daa503f000200000f/1.in: -------------------------------------------------------------------------------- 1 | (a) (abc) (abcd) (123456) 2 | -------------------------------------------------------------------------------- /test/vim/golf/50d0c33daa503f000200000f/1.ref: -------------------------------------------------------------------------------- 1 | ___ _____ ______ ________ 2 | -------------------------------------------------------------------------------- /test/vim/golf/50ee7504c0e3aa0002000040/1.in: -------------------------------------------------------------------------------- 1 | vimchallenge 2 | -------------------------------------------------------------------------------- /test/vim/golf/50ee7504c0e3aa0002000040/1.ref: -------------------------------------------------------------------------------- 1 | vimchallenge 2 | vimchalleng 3 | vimchallen 4 | vimchalle 5 | vimchall 6 | vimchal 7 | vimcha 8 | vimch 9 | vimc 10 | vim 11 | vi 12 | v 13 | 14 | vimchallenge 15 | imchallenge 16 | mchallenge 17 | challenge 18 | hallenge 19 | allenge 20 | llenge 21 | lenge 22 | enge 23 | nge 24 | ge 25 | e 26 | -------------------------------------------------------------------------------- /test/vim/golf/51103ad8041832000200003f/1.in: -------------------------------------------------------------------------------- 1 | vim 2 | -------------------------------------------------------------------------------- /test/vim/golf/51103ad8041832000200003f/1.ref: -------------------------------------------------------------------------------- 1 | v v v v v v v v v v v v v v v v v v v v v v 2 | vimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvim 3 | m m m m m m m m m m m m m m m m m m m m m m 4 | v v v v v v v v v v v v v v v v v v v v v v 5 | vimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvim 6 | m m m m m m m m m m m m m m m m m m m m m m 7 | v v v v v v v v v v v v v v v v v v v v v v 8 | vimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvim 9 | m m m m m m m m m m m m m m m m m m m m m m 10 | v v v v v v v v v v v v v v v v v v v v v v 11 | vimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvim 12 | m m m m m m m m m m m m m m m m m m m m m m 13 | v v v v v v v v v v v v v v v v v v v v v v 14 | vimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvim 15 | m m m m m m m m m m m m m m m m m m m m m m 16 | v v v v v v v v v v v v v v v v v v v v v v 17 | vimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvim 18 | m m m m m m m m m m m m m m m m m m m m m m 19 | v v v v v v v v v v v v v v v v v v v v v v 20 | vimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvimvim 21 | m m m m m m m m m m m m m m m m m m m m m m 22 | -------------------------------------------------------------------------------- /test/vim/golf/5192f96ad8df110002000002/1.in: -------------------------------------------------------------------------------- 1 | one two 2 | three 3 | -------------------------------------------------------------------------------- /test/vim/golf/5192f96ad8df110002000002/1.ref: -------------------------------------------------------------------------------- 1 | (one) (two) 2 | (three) 3 | -------------------------------------------------------------------------------- /test/vim/golf/524e1a20b81fe50002000008/1.in: -------------------------------------------------------------------------------- 1 | attr_reader :align, :variables, :with 2 | attr_accessor :spaces, :to, :complete, :challenge 3 | # vim: set expandtab: 4 | -------------------------------------------------------------------------------- /test/vim/golf/524e1a20b81fe50002000008/1.ref: -------------------------------------------------------------------------------- 1 | attr_reader :align, 2 | :variables, 3 | :with 4 | attr_accessor :spaces, 5 | :to, 6 | :complete, 7 | :challenge 8 | # vim: set expandtab: 9 | -------------------------------------------------------------------------------- /test/vim/golf/52c3cb0d9b8634000200000e/1.in: -------------------------------------------------------------------------------- 1 | A HAPPY END WITH YEAR 2013 ! 2 | -------------------------------------------------------------------------------- /test/vim/golf/52c3cb0d9b8634000200000e/1.ref: -------------------------------------------------------------------------------- 1 | A HAPPY NEW YEAR 2014 ! 2 | -------------------------------------------------------------------------------- /test/vim/golf/53369b712a09c1000223fb57/1.in: -------------------------------------------------------------------------------- 1 | /* Frame (32 bytes) */ 2 | static const unsigned char pkt1[32] = { 3 | 0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */ 4 | 0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */ 5 | 0x05, 0xdc, 0x1b, 0xe3, 0x40, 0x00, 0x31, 0x06, /* ....@.1. */ 6 | 0xe8, 0xc8, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8 /* ........ */ 7 | }; 8 | 9 | /* Frame (32 bytes) */ 10 | static const unsigned char pkt2[32] = { 11 | 0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */ 12 | 0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */ 13 | 0x05, 0xdc, 0x6b, 0x98, 0x40, 0x00, 0x31, 0x06, /* ..k.@.1. */ 14 | 0x99, 0x13, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8, /* ........ */ 15 | }; 16 | -------------------------------------------------------------------------------- /test/vim/golf/53369b712a09c1000223fb57/1.ref: -------------------------------------------------------------------------------- 1 | /* Frame (32 bytes) */ 2 | static const unsigned char pkt1[2][32] = { 3 | { 4 | 0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */ 5 | 0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */ 6 | 0x05, 0xdc, 0x1b, 0xe3, 0x40, 0x00, 0x31, 0x06, /* ....@.1. */ 7 | 0xe8, 0xc8, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8 /* ........ */ 8 | }, 9 | { 10 | 0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */ 11 | 0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */ 12 | 0x05, 0xdc, 0x6b, 0x98, 0x40, 0x00, 0x31, 0x06, /* ..k.@.1. */ 13 | 0x99, 0x13, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8, /* ........ */ 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /test/vim/golf/536cfa23fcccd100025678bd/1.in: -------------------------------------------------------------------------------- 1 | attr("y",function(v){return v}) 2 | -------------------------------------------------------------------------------- /test/vim/golf/536cfa23fcccd100025678bd/1.ref: -------------------------------------------------------------------------------- 1 | f=function(v){return v}; 2 | attr("y",f) 3 | -------------------------------------------------------------------------------- /test/vim/golf/537a553282aa3e000222048a/1.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
4 | First NameLast NameAddressCityStateZipCountryPhone
15 | -------------------------------------------------------------------------------- /test/vim/golf/537a553282aa3e000222048a/1.ref: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
4 | First Name Last Name Address City State Zip Country Phone
15 | -------------------------------------------------------------------------------- /test/vim/golf/53d93fc3768e280002124f23/1.in: -------------------------------------------------------------------------------- 1 | VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 2 | -------------------------------------------------------------------------------- /test/vim/golf/53d93fc3768e280002124f23/1.ref: -------------------------------------------------------------------------------- 1 | iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii 2 | -------------------------------------------------------------------------------- /test/vim/golf/54595b13128576000257a3c1/1.in: -------------------------------------------------------------------------------- 1 | 10 PRINT "The actual" 2 | 15 PRINT "code doesn't" 3 | 16 PRINT "really matter." 4 | 20 PRINT "Just take" 5 | 25 PRINT "care of" 6 | 30 PRINT "the numbers." 7 | -------------------------------------------------------------------------------- /test/vim/golf/54595b13128576000257a3c1/1.ref: -------------------------------------------------------------------------------- 1 | 10 PRINT "The actual" 2 | 20 PRINT "code doesn't" 3 | 30 PRINT "really matter." 4 | 40 PRINT "Just take" 5 | 50 PRINT "care of" 6 | 60 PRINT "the numbers." 7 | -------------------------------------------------------------------------------- /test/vim/golf/5462e3f41198b80002512673/1.in: -------------------------------------------------------------------------------- 1 | foo = a 2 | ab 3 | abc 4 | -------------------------------------------------------------------------------- /test/vim/golf/5462e3f41198b80002512673/1.ref: -------------------------------------------------------------------------------- 1 | foo = "a" 2 | "ab" 3 | "abc" 4 | -------------------------------------------------------------------------------- /test/vim/golf/54698da795f6da00020d85ed/1.in: -------------------------------------------------------------------------------- 1 | enum PlaybackRequestType { 2 | case Next 3 | case Previous 4 | case Play 5 | case Stop 6 | } 7 | -------------------------------------------------------------------------------- /test/vim/golf/54698da795f6da00020d85ed/1.ref: -------------------------------------------------------------------------------- 1 | enum PlaybackRequestType { 2 | case Next, Previous, Play, Stop 3 | } 4 | -------------------------------------------------------------------------------- /test/vim/golf/54862fbb3f90ac0002904cf5/1.in: -------------------------------------------------------------------------------- 1 | Leave only the 2 | numbered lines. 3 | LINE 1 4 | LINE 2 5 | LINE 3 6 | That's all. 7 | Thank you 8 | very much. 9 | -------------------------------------------------------------------------------- /test/vim/golf/54862fbb3f90ac0002904cf5/1.ref: -------------------------------------------------------------------------------- 1 | LINE 1 2 | LINE 2 3 | LINE 3 4 | -------------------------------------------------------------------------------- /test/vim/golf/55771cc4750ef86573003b83/1.in: -------------------------------------------------------------------------------- 1 | foo { 2 | a => "a", 3 | bc => "bc", 4 | def => "def", 5 | ghij => "ghij", 6 | k => "k", 7 | lmn => "lmn", 8 | opqrst => "opqrst", 9 | uvw => "uvw", 10 | xyz => "xyz", 11 | } 12 | -------------------------------------------------------------------------------- /test/vim/golf/55771cc4750ef86573003b83/1.ref: -------------------------------------------------------------------------------- 1 | foo { 2 | a => "a", 3 | bc => "bc", 4 | def => "def", 5 | ghij => "ghij", 6 | k => "k", 7 | lmn => "lmn", 8 | opqrst => "opqrst", 9 | uvw => "uvw", 10 | xyz => "xyz", 11 | } 12 | -------------------------------------------------------------------------------- /test/vim/golf/559c30948ef59c0eb7000002/1.in: -------------------------------------------------------------------------------- 1 | * item1 2 | * item2 3 | * item3 4 | * item4 5 | * item5 6 | -------------------------------------------------------------------------------- /test/vim/golf/559c30948ef59c0eb7000002/1.ref: -------------------------------------------------------------------------------- 1 | item1,item2,item3,item4,item5 2 | -------------------------------------------------------------------------------- /test/vim/golf/55b18bbea9c2c30d04000001/1.in: -------------------------------------------------------------------------------- 1 | *temp var1 0 2 | *temp var2 "hi" 3 | *temp var3 -1 4 | *temp var4 42 5 | *temp var5 "asdf" 6 | *temp var6 0 7 | 8 | Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way." 9 | 10 | This challenge is just a simple movement and entering text at a certain place. 11 | -------------------------------------------------------------------------------- /test/vim/golf/55b18bbea9c2c30d04000001/1.ref: -------------------------------------------------------------------------------- 1 | *temp var1 0 2 | *temp var2 "hi" 3 | *temp var3 -1 4 | *temp var4 42 5 | *temp var5 "asdf" 6 | *temp var6 0 7 | *temp var7 11 8 | 9 | Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way." 10 | 11 | New text. 12 | 13 | This challenge is just a simple movement and entering text at a certain place. 14 | -------------------------------------------------------------------------------- /test/vim/golf/55bcdc3ef4219f456102374f/1.in: -------------------------------------------------------------------------------- 1 | The quick brown fox jumps over the lazy dog. 2 | -------------------------------------------------------------------------------- /test/vim/golf/55bcdc3ef4219f456102374f/1.ref: -------------------------------------------------------------------------------- 1 | The quick lazy dog jumps over the brown fox. 2 | -------------------------------------------------------------------------------- /test/vim/golf/55f9720b4a665c2acf0008c8/1.in: -------------------------------------------------------------------------------- 1 | Lôrem Ipsum 2 | Dolor.eros 3 | Auctor: eros (elémentum) 4 | Tincïdunt, âc 5 | -------------------------------------------------------------------------------- /test/vim/golf/55f9720b4a665c2acf0008c8/1.ref: -------------------------------------------------------------------------------- 1 | lorem-ipsum: 2 | name: "Lôrem Ipsum" 3 | dolor-eros: 4 | name: "Dolor.eros" 5 | auctor-eros-elementum: 6 | name: "Auctor: eros (elémentum)" 7 | tincidunt-ac: 8 | name: "Tincïdunt, âc" 9 | -------------------------------------------------------------------------------- /test/vim/motions/goto.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | -------------------------------------------------------------------------------- /test/vim/motions/goto.keys: -------------------------------------------------------------------------------- 1 | 0G 2 | olast line 3 | gg 4 | Ofirst line 5 | 3G 6 | c$middle line 7 | -------------------------------------------------------------------------------- /test/vim/operators/change/change.in: -------------------------------------------------------------------------------- 1 | hello world 2 | hello world 3 | Bye! 4 | -------------------------------------------------------------------------------- /test/vim/operators/change/change.keys: -------------------------------------------------------------------------------- 1 | cwfoow. 2 | 2G 3 | ccbar bar. 4 | -------------------------------------------------------------------------------- /test/vim/operators/delete/delete.in: -------------------------------------------------------------------------------- 1 | one two 2 | three four 3 | five six 4 | seven eigth 5 | nine ten 6 | -------------------------------------------------------------------------------- /test/vim/operators/delete/delete.keys: -------------------------------------------------------------------------------- 1 | /two 2 | djd2j 3 | -------------------------------------------------------------------------------- /test/vim/operators/insert/append.in: -------------------------------------------------------------------------------- 1 | 0123456789 2 | -------------------------------------------------------------------------------- /test/vim/operators/insert/append.keys: -------------------------------------------------------------------------------- 1 | 4a# 2 | f9 3 | 2. 4 | -------------------------------------------------------------------------------- /test/vim/operators/insert/insert.in: -------------------------------------------------------------------------------- 1 | 0123456789 2 | -------------------------------------------------------------------------------- /test/vim/operators/insert/insert.keys: -------------------------------------------------------------------------------- 1 | 4i# 2 | f9 3 | 2. 4 | -------------------------------------------------------------------------------- /test/vim/operators/join/count.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | -------------------------------------------------------------------------------- /test/vim/operators/join/count.keys: -------------------------------------------------------------------------------- 1 | 3J 2 | -------------------------------------------------------------------------------- /test/vim/operators/join/empty.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/vim/operators/join/empty.keys: -------------------------------------------------------------------------------- 1 | j 2 | J 3 | J 4 | J 5 | J 6 | J -------------------------------------------------------------------------------- /test/vim/operators/join/visual-line.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 9 9 | 10 10 | -------------------------------------------------------------------------------- /test/vim/operators/join/visual-line.keys: -------------------------------------------------------------------------------- 1 | jV2jJ 2 | /6 3 | VJ -------------------------------------------------------------------------------- /test/vim/operators/join/visual.in: -------------------------------------------------------------------------------- 1 | first 2 | second 3 | third 4 | fourth 5 | fifth 6 | sixth 7 | seventh 8 | eighth 9 | ninth 10 | -------------------------------------------------------------------------------- /test/vim/operators/join/visual.keys: -------------------------------------------------------------------------------- 1 | /c 2 | v2gjJ 3 | /x 4 | v2gjgJ 5 | -------------------------------------------------------------------------------- /test/vim/operators/join/whitespace.in: -------------------------------------------------------------------------------- 1 | 2 | non empty preceding line 3 | join 4 | 5 | non empty preceding line white trailing white space 6 | join 7 | 8 | empty preceding line 9 | 10 | join 11 | 12 | -------------------------------------------------------------------------------- /test/vim/operators/join/whitespace.keys: -------------------------------------------------------------------------------- 1 | /join 2 | k$J 3 | 2n 4 | k$J 5 | n 6 | k$J 7 | -------------------------------------------------------------------------------- /test/vim/operators/openline/openline.in: -------------------------------------------------------------------------------- 1 | === 2 | --- 3 | === 4 | -------------------------------------------------------------------------------- /test/vim/operators/openline/openline.keys: -------------------------------------------------------------------------------- 1 | 2Obefore 2 | 2/=== 3 | 3. 4 | gg 5 | n 6 | 2oafter 7 | n 8 | 3. 9 | -------------------------------------------------------------------------------- /test/vim/operators/put/put.in: -------------------------------------------------------------------------------- 1 | one two 2 | -------------------------------------------------------------------------------- /test/vim/operators/put/put.keys: -------------------------------------------------------------------------------- 1 | ywPw3Pw. 2 | -------------------------------------------------------------------------------- /test/vim/operators/put/visual.in: -------------------------------------------------------------------------------- 1 | longword 2 | short 3 | -------------------------------------------------------------------------------- /test/vim/operators/put/visual.keys: -------------------------------------------------------------------------------- 1 | yejvep 2 | anewline 3 | 4 | -------------------------------------------------------------------------------- /test/vim/operators/replace/replace.in: -------------------------------------------------------------------------------- 1 | int foo() { 2 | /* --- --- */ 3 | return 42; 4 | /* --- --- */ 5 | } 6 | -------------------------------------------------------------------------------- /test/vim/operators/replace/replace.keys: -------------------------------------------------------------------------------- 1 | t{r /* replace space with new line */ 2 | /--- 3 | 3r= /* replace --- with === */ 4 | n /* advance to next match */ 5 | . /* repeat */ 6 | r /* cancel, should not alter text */ 7 | n /* advance to next match */ 8 | v2e /* select something in visual mode */ 9 | r /* cancel, should not alter text */ 10 | r= /* replace selection */ 11 | -------------------------------------------------------------------------------- /test/vim/operators/shift/shift.in: -------------------------------------------------------------------------------- 1 | one two 2 | one two 3 | -------------------------------------------------------------------------------- /test/vim/operators/shift/shift.keys: -------------------------------------------------------------------------------- 1 | >>j<< 2 | -------------------------------------------------------------------------------- /test/vim/operators/yank/yank.in: -------------------------------------------------------------------------------- 1 | one two 2 | -------------------------------------------------------------------------------- /test/vim/operators/yank/yank.keys: -------------------------------------------------------------------------------- 1 | y$P0yyp.. 2 | -------------------------------------------------------------------------------- /test/vim/registers/black-hole.in: -------------------------------------------------------------------------------- 1 | Black hole register "_ 2 | 3 | When writing to this register, nothing happens. This can be used to delete 4 | text without affecting the normal registers. When reading from this register, 5 | nothing is returned. {not in Vi} 6 | -------------------------------------------------------------------------------- /test/vim/registers/black-hole.keys: -------------------------------------------------------------------------------- 1 | "_yy 2 | p 3 | j 4 | dd 5 | "_dd 6 | P 7 | "_3p 8 | -------------------------------------------------------------------------------- /test/vim/registers/command.in: -------------------------------------------------------------------------------- 1 | ": Contains the most recent executed command-line. 2 | Example: Use "@:" to repeat the previous command-line command. 3 | -------------------------------------------------------------------------------- /test/vim/registers/command.keys: -------------------------------------------------------------------------------- 1 | :+-d 2 | O: 3 | j 4 | @: 5 | -------------------------------------------------------------------------------- /test/vim/registers/named.in: -------------------------------------------------------------------------------- 1 | Named registers "a to "z or "A to "Z 2 | 3 | Vim fills these registers only when you say so. Specify them as lowercase 4 | letters to replace their previous contents or as uppercase letters to append 5 | to their previous contents. 6 | -------------------------------------------------------------------------------- /test/vim/registers/named.keys: -------------------------------------------------------------------------------- 1 | "ayy 2 | j 3 | "Ayy 4 | j 5 | "Byy 6 | j 7 | "Byy 8 | j 9 | "cyy 10 | o--------- 11 | "ap 12 | "bp 13 | "cp 14 | -------------------------------------------------------------------------------- /test/vim/registers/search.in: -------------------------------------------------------------------------------- 1 | Last search pattern register "/ 2 | Contains the most recent search-pattern. 3 | {not in Vi} 4 | -------------------------------------------------------------------------------- /test/vim/registers/search.keys: -------------------------------------------------------------------------------- 1 | /search 2 | O 3 | / 4 | /pattern 5 | G 6 | o 7 | / 8 | -------------------------------------------------------------------------------- /test/vim/registers/zero.in: -------------------------------------------------------------------------------- 1 | Register "0 2 | 3 | Numbered register 0 contains the text from the most recent yank command, 4 | unless the command specified another register with ["x]. 5 | 6 | -------------------------------------------------------------------------------- /test/vim/registers/zero.keys: -------------------------------------------------------------------------------- 1 | "ayy 2 | "0p 3 | "Ayy 4 | "0p 5 | yy 6 | G 7 | "0p -------------------------------------------------------------------------------- /test/vim/special-files/combining.in: -------------------------------------------------------------------------------- 1 | à̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̯̰̱̲̳̹̺̻̼͇͈͉͍͎́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚͠͡ͅ-à̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̯̰̱̲̳̹̺̻̼͇͈͉͍͎́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚͠͡ͅ 2 | -------------------------------------------------------------------------------- /test/vim/special-files/combining.keys: -------------------------------------------------------------------------------- 1 | ga 2 | g8 3 | dl 4 | $ 5 | a+ 6 | p 7 | -------------------------------------------------------------------------------- /test/vim/special-files/mmap.keys: -------------------------------------------------------------------------------- 1 | O=== 2 | G 3 | o=== 4 | -------------------------------------------------------------------------------- /test/vim/special-files/search-binary.in: -------------------------------------------------------------------------------- 1 | HelloHelloHello 2 | -------------------------------------------------------------------------------- /test/vim/special-files/search-binary.keys: -------------------------------------------------------------------------------- 1 | /Hello 2 | i> 3 | n. 4 | N. 5 | N. 6 | -------------------------------------------------------------------------------- /test/vim/text-objects/braces-count-linewise.in: -------------------------------------------------------------------------------- 1 | struct { 2 | union { 3 | int foo; 4 | }; 5 | }; 6 | -------------------------------------------------------------------------------- /test/vim/text-objects/braces-count-linewise.keys: -------------------------------------------------------------------------------- 1 | /foo 2 | v2a}Vd 3 | -------------------------------------------------------------------------------- /test/vim/text-objects/words-count.in: -------------------------------------------------------------------------------- 1 | The brown fox jumps over the lazy dog. 2 | -------------------------------------------------------------------------------- /test/vim/text-objects/words-count.keys: -------------------------------------------------------------------------------- 1 | 3ciwchanged 2 | /fox 3 | 5. 4 | -------------------------------------------------------------------------------- /test/vim/text-objects/words-eol.in: -------------------------------------------------------------------------------- 1 | a 2 | b 3 | -------------------------------------------------------------------------------- /test/vim/text-objects/words-eol.keys: -------------------------------------------------------------------------------- 1 | viwc- -------------------------------------------------------------------------------- /test/vim/text-objects/words-symbols.in: -------------------------------------------------------------------------------- 1 | spaces: # 2 | tabs: # 3 | start: #== 4 | middle: =#= 5 | end: ==# 6 | start: #bc 7 | middle: a#b 8 | end: ab# 9 | start: ># < 10 | middle: > # < 11 | end: > #< 12 | start: (_) 13 | middle: (o_o) 14 | end: (Oo_) 15 | -------------------------------------------------------------------------------- /test/vim/text-objects/words-symbols.keys: -------------------------------------------------------------------------------- 1 | /# 2 | ciw| 3 | n. 4 | n. 5 | n. 6 | n. 7 | n. 8 | n. 9 | n. 10 | nr 11 | ciw| 12 | nr 13 | ciw| 14 | nr 15 | ciw| 16 | /_ 17 | . 18 | n. 19 | n. 20 | -------------------------------------------------------------------------------- /test/vim/visrc.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martanne/vis/bef2261962ca3636531957baf0abe1503f8c4f97/test/vim/visrc.lua -------------------------------------------------------------------------------- /test/vis/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.err 3 | *.disabled -------------------------------------------------------------------------------- /test/vis/Makefile: -------------------------------------------------------------------------------- 1 | test: ../../vis clean 2 | @./test.sh 3 | 4 | ../../vis: ../../*.[ch] 5 | @echo Compiling vis 6 | @$(MAKE) -C ../.. 7 | 8 | clean: 9 | @echo cleaning 10 | @find . -name '*.out' -o -name '*.err' | xargs rm -f 11 | 12 | .PHONY: clean test 13 | -------------------------------------------------------------------------------- /test/vis/README.md: -------------------------------------------------------------------------------- 1 | Tests for vis specific editing features 2 | --------------------------------------- 3 | 4 | The basic idea is to feed keyboard input to `vis` and compare the 5 | produced output with a known reference solution. 6 | 7 | A test constitutes of 3 files: 8 | 9 | * `test.in` the file/buffer content with which the editor is started 10 | * `test.keys` a file containing the keyboard input as would normally 11 | be typed by a user 12 | * `test.ref` a reference file at the end of the editing session 13 | 14 | The toplevel shell script `test.sh` looks for these files in sub 15 | directories, feeds the keys to `vis` and compares the produces output. 16 | 17 | Type `make` to run all tests. 18 | -------------------------------------------------------------------------------- /test/vis/errors/filter.in: -------------------------------------------------------------------------------- 1 | Filter command failed 2 | -------------------------------------------------------------------------------- /test/vis/errors/filter.keys: -------------------------------------------------------------------------------- 1 | :1 | tr a-z A-Z && false 2 | -------------------------------------------------------------------------------- /test/vis/errors/filter.ref: -------------------------------------------------------------------------------- 1 | Filter command failed 2 | -------------------------------------------------------------------------------- /test/vis/errors/pipe-in.in: -------------------------------------------------------------------------------- 1 | Pipe in command failed 2 | -------------------------------------------------------------------------------- /test/vis/errors/pipe-in.keys: -------------------------------------------------------------------------------- 1 | :1 < echo FAILED && false 2 | -------------------------------------------------------------------------------- /test/vis/errors/pipe-in.ref: -------------------------------------------------------------------------------- 1 | Pipe in command failed 2 | -------------------------------------------------------------------------------- /test/vis/insert-mode/autoindent.in: -------------------------------------------------------------------------------- 1 | int foo(int a) { 2 | for (;;) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/vis/insert-mode/autoindent.keys: -------------------------------------------------------------------------------- 1 | :set ai 2 | /for 3 | o 4 | 5 | if (a > 0) { 6 | // positive 7 | return --a; 8 | } else if (a < 0) { 9 | // negative 10 | return ++a; 11 | } else { 12 | // equal 13 | return a; 14 | } 15 | 16 | n 17 | O// optimized loop 18 | -------------------------------------------------------------------------------- /test/vis/insert-mode/autoindent.ref: -------------------------------------------------------------------------------- 1 | int foo(int a) { 2 | 3 | // optimized loop 4 | for (;;) { 5 | 6 | if (a > 0) { 7 | // positive 8 | 9 | return --a; 10 | } else if (a < 0) { 11 | // negative 12 | 13 | return ++a; 14 | } else { 15 | // equal 16 | 17 | return a; 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/vis/insert-mode/digraph.in: -------------------------------------------------------------------------------- 1 | digraphs 2 | l* = 3 | l* = 4 | FA = 5 | FA = 6 | (- = 7 | (- = 8 | -------------------------------------------------------------------------------- /test/vis/insert-mode/digraph.keys: -------------------------------------------------------------------------------- 1 | /= 2 | al* 3 | n.n 4 | aFA 5 | n.n 6 | a(- 7 | n. 8 | -------------------------------------------------------------------------------- /test/vis/insert-mode/digraph.ref: -------------------------------------------------------------------------------- 1 | digraphs 2 | l* = λ 3 | l* = λ 4 | FA = ∀ 5 | FA = ∀ 6 | (- = ∈ 7 | (- = ∈ 8 | -------------------------------------------------------------------------------- /test/vis/insert-mode/verbatim.in: -------------------------------------------------------------------------------- 1 | U+033b = 2 | U+033b = 3 | U+2200 = 4 | U+2200 = 5 | U+2208 = 6 | U+2208 = 7 | U+00002208 = 8 | U+00002208 = 9 | 0x40 = 10 | 0X40 = 11 | o100 = 12 | O100 = 13 | 64 = 14 | U+07FF = 15 | U+D7FF = 16 | U+DFFF = /* not really correct */ 17 | U+FFFD = 18 | U+FFFF = /* not really correct */ 19 | U+10FFFF = 20 | U+11000 = /* invalid */ 21 | = 22 | = 23 | = 24 | = 25 | -------------------------------------------------------------------------------- /test/vis/insert-mode/verbatim.keys: -------------------------------------------------------------------------------- 1 | /= 2 | au03bb 3 | n.n 4 | au2200 5 | n.n 6 | au2208 7 | n.n 8 | aU2208 9 | n.n 10 | ax40 11 | n 12 | aX40 13 | n 14 | ao100 15 | n 16 | aO100 17 | n 18 | a64 19 | n 20 | au07FF 21 | n 22 | auD7FF 23 | n 24 | auDFFF 25 | n 26 | auFFFD 27 | n 28 | auFFFF 29 | n 30 | aU0010FFFF 31 | n 32 | aU00110000 33 | n 34 | a 35 | n 36 | :set et 37 | a 38 | n 39 | a 40 | n 41 | a 42 | -------------------------------------------------------------------------------- /test/vis/insert-mode/verbatim.ref: -------------------------------------------------------------------------------- 1 | U+033b = λ 2 | U+033b = λ 3 | U+2200 = ∀ 4 | U+2200 = ∀ 5 | U+2208 = ∈ 6 | U+2208 = ∈ 7 | U+00002208 = ∈ 8 | U+00002208 = ∈ 9 | 0x40 = @ 10 | 0X40 = @ 11 | o100 = @ 12 | O100 = @ 13 | 64 = @ 14 | U+07FF = ߿ 15 | U+D7FF = ퟿ 16 | U+DFFF = /* not really correct */ 17 | U+FFFD = � 18 | U+FFFF = /* not really correct */ 19 | U+10FFFF = 􏿿 20 | U+11000 = /* invalid */ 21 | =  22 | = 23 | = 24 | = 25 | -------------------------------------------------------------------------------- /test/vis/interop/pre-save-grows.in: -------------------------------------------------------------------------------- 1 | one 2 | two 3 | -------------------------------------------------------------------------------- /test/vis/interop/pre-save-grows.keys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martanne/vis/bef2261962ca3636531957baf0abe1503f8c4f97/test/vis/interop/pre-save-grows.keys -------------------------------------------------------------------------------- /test/vis/interop/pre-save-grows.lua: -------------------------------------------------------------------------------- 1 | vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file) 2 | local lines = file.lines 3 | for i=1, #lines do 4 | lines[i] = lines[i]..' bigger' 5 | end 6 | return true 7 | end) 8 | -------------------------------------------------------------------------------- /test/vis/interop/pre-save-grows.ref: -------------------------------------------------------------------------------- 1 | one bigger 2 | two bigger 3 | -------------------------------------------------------------------------------- /test/vis/interop/pre-save-shrinks.in: -------------------------------------------------------------------------------- 1 | halfhalf 2 | -------------------------------------------------------------------------------- /test/vis/interop/pre-save-shrinks.keys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martanne/vis/bef2261962ca3636531957baf0abe1503f8c4f97/test/vis/interop/pre-save-shrinks.keys -------------------------------------------------------------------------------- /test/vis/interop/pre-save-shrinks.lua: -------------------------------------------------------------------------------- 1 | vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file) 2 | local lines = file.lines 3 | for i=1, #lines do 4 | lines[i] = lines[i]:sub(lines[i]:len()/2+1) 5 | end 6 | return true 7 | end) 8 | -------------------------------------------------------------------------------- /test/vis/interop/pre-save-shrinks.ref: -------------------------------------------------------------------------------- 1 | half 2 | -------------------------------------------------------------------------------- /test/vis/mappings/insert-mode.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martanne/vis/bef2261962ca3636531957baf0abe1503f8c4f97/test/vis/mappings/insert-mode.in -------------------------------------------------------------------------------- /test/vis/mappings/insert-mode.keys: -------------------------------------------------------------------------------- 1 | :map! insert jj 2 | ij 3 | :map! insert jj >< 4 | Ojj 5 | :map! insert >> ><>x> 6 | o>> 7 | -------------------------------------------------------------------------------- /test/vis/mappings/insert-mode.ref: -------------------------------------------------------------------------------- 1 | >< 2 | ><>x> 3 | j -------------------------------------------------------------------------------- /test/vis/motions/line-begin.in: -------------------------------------------------------------------------------- 1 | 0 To the first character of the line. 2 | 1 From start to start 3 | 2 From _ to start 4 | 3 From end to start 4 empty line \n 5 empty line \r\n 5 | 6 | 7 | 6 Spaces 8 | 7 Tabs 9 |  8 Backspace 10 | 9 Vertical tab 11 | 10 Form feed 12 | 11 Carriage return 13 | 12 Idempotent (count has no effect) 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-begin.keys: -------------------------------------------------------------------------------- 1 | + 2 | d0+ 3 | f_.+ 4 | $.+ 5 | .+ 6 | ./[0-9]+ 7 | .$n 8 | .$n 9 | .$n 10 | .$n 11 | .$n 12 | .$n 13 | 99.$n 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-begin.ref: -------------------------------------------------------------------------------- 1 | 0 To the first character of the line. 2 | 1 From start to start 3 | _ to start 4 | 5 | 6 | 7 | 6 Spaces 8 | 7 Tabs 9 | 8 Backspace 10 | 9 Vertical tab 11 | 10 Form feed 12 | 11 Carriage return 13 | 12 Idempotent (count has no effect) 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-char-first.in: -------------------------------------------------------------------------------- 1 | ^ To the first non-blank character of the line. 2 | 1 From start to start 3 | 2 From _ to start 4 | 3 From end to start 4 empty line \n 5 empty line \r\n 5 | 6 | 7 | 6 Spaces 8 | 7 Tabs 9 |  8 Backspace 10 | 9 Vertical tab 11 | 10 Form feed 12 | 11 Carriage return 13 | 12 Idempotent (count has no effect) 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-char-first.keys: -------------------------------------------------------------------------------- 1 | + 2 | d^+ 3 | f_.+ 4 | $.+ 5 | .+ 6 | .+ 7 | 0.+ 8 | 0.+ 9 | 0.+ 10 | 0.+ 11 | 0.+ 12 | 0.+ 13 | 099.+ 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-char-first.ref: -------------------------------------------------------------------------------- 1 | ^ To the first non-blank character of the line. 2 | 1 From start to start 3 | _ to start 4 | 5 | 6 | 7 | 6 Spaces 8 | 7 Tabs 9 |  8 Backspace 10 | 9 Vertical tab 11 | 10 Form feed 12 | 11 Carriage return 13 | 12 Idempotent (count has no effect) 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-char-last.in: -------------------------------------------------------------------------------- 1 | g_ To the last non-blank character of the line. 2 | 1 From start to end 3 | 2 From _ to end 4 | 3 From end to end 4 empty line \n 5 empty line \r\n 5 | 6 | 7 | 6 Spaces 8 | 7 Tabs 9 | 8 Backspace  10 | 9 Vertical tab 11 | 10 Form feed 12 | 11 Carriage return 13 | 12 Idempotent (count has no effect) 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-char-last.keys: -------------------------------------------------------------------------------- 1 | + 2 | dg_+ 3 | f_.+ 4 | $.+ 5 | .+ 6 | .+ 7 | $.+ 8 | $.+ 9 | $.+ 10 | $.+ 11 | $.+ 12 | $.+ 13 | $99.+ 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-char-last.ref: -------------------------------------------------------------------------------- 1 | g_ To the last non-blank character of the line. 2 | 3 | 2 From 4 | 3 From end to end 4 empty line \n 5 empty line \r\ 5 | 6 | 7 | 6 Space 8 | 7 Tab 9 | 8 Backspace 10 | 9 Vertical tab 11 | 10 Form feed 12 | 11 Carriage return 13 | 12 Idempotent (count has no effect 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-end.in: -------------------------------------------------------------------------------- 1 | $ To the end of the line. 2 | 1 From start to end 3 | 2 From _ to end 4 | 3 From end to end 4 empty line \n 5 empty line \r\n 5 | 6 | 7 | 6 Spaces 8 | 7 Tabs 9 | 8 Backspace  10 | 9 Vertical tab 11 | 10 Form feed 12 | 11 Carriage return 13 | 12 Idempotent (count has no effect) 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-end.keys: -------------------------------------------------------------------------------- 1 | + 2 | d$+ 3 | f_.+ 4 | $.+ 5 | .+ 6 | .+ 7 | 2f.+ 8 | 2;.+ 9 | 2;.+ 10 | 2;.+ 11 | 2;.+ 12 | 2;.+ 13 | 2;99.+ 14 | -------------------------------------------------------------------------------- /test/vis/motions/line-end.ref: -------------------------------------------------------------------------------- 1 | $ To the end of the line. 2 | 3 | 2 From 4 | 3 From end to end 4 empty line \n 5 empty line \r\n 5 | 6 | 7 | 8 | 7 Tabs 9 | 8 Backspace 10 | 9 Vertical 11 | 10 Form 12 | 11 Carriage 13 | 12 Idempotent 14 | -------------------------------------------------------------------------------- /test/vis/motions/next-end-of-bigword.in: -------------------------------------------------------------------------------- 1 | _start-word next 2 | mid_dle-word next 3 | end-word_ next 4 | starting from a space 5 | starting from a tab 6 | a b c d : single letter words 7 | skipping-tab next 8 | +-*/\"'`^%&,;|_(){}<>[]=?! special symbols 9 | 10 | next line 11 | word_at_end 12 | -------------------------------------------------------------------------------- /test/vis/motions/next-end-of-bigword.keys: -------------------------------------------------------------------------------- 1 | f_Er|+ 2 | ;E.+ 3 | ;E.+ 4 | 0E.+ 5 | 0E.+ 6 | 4E.+ 7 | 2E.+ 8 | E.+ 9 | E 10 | .+ 11 | E. 12 | -------------------------------------------------------------------------------- /test/vis/motions/next-end-of-bigword.ref: -------------------------------------------------------------------------------- 1 | _start-wor| next 2 | mid_dle-wor| next 3 | end-word_ nex| 4 | startin| from a space 5 | startin| from a tab 6 | a b c d | single letter words 7 | skipping-tab nex| 8 | +-*/\"'`^%&,;|_(){}<>[]=?| special symbols 9 | 10 | nex| line 11 | word_at_en| 12 | -------------------------------------------------------------------------------- /test/vis/motions/next-end-of-word.in: -------------------------------------------------------------------------------- 1 | _start next 2 | mid_dle next 3 | end_ next 4 | starting from a space 5 | starting from a tab 6 | a b c d : single letter words 7 | tab next 8 | word with count 9 | +-*/\"'`^%&,;|_(){}<>[]=?! special symbols 10 | 11 | next line 12 | word_at_end 13 | -------------------------------------------------------------------------------- /test/vis/motions/next-end-of-word.keys: -------------------------------------------------------------------------------- 1 | f_er|+ 2 | ;e.+ 3 | ;e.+ 4 | 0e.+ 5 | 0e.+ 6 | 4e.+ 7 | 2e.+ 8 | 2e.+ 9 | e.+ 10 | e 11 | .+ 12 | e. 13 | -------------------------------------------------------------------------------- /test/vis/motions/next-end-of-word.ref: -------------------------------------------------------------------------------- 1 | _star| next 2 | mid_dl| next 3 | end_ nex| 4 | startin| from a space 5 | startin| from a tab 6 | a b c d | single letter words 7 | tab nex| 8 | word wit| count 9 | +-*/\"'`^%&,;|_(){}<>[]=?! special symbols 10 | 11 | nex| line 12 | word_at_en| 13 | -------------------------------------------------------------------------------- /test/vis/motions/next-start-of-bigword.in: -------------------------------------------------------------------------------- 1 | _start-word next 2 | mid_dle-word next 3 | end-word_ next 4 | starting from a space 5 | starting from a tab 6 | a b c d : single letter words 7 | tab next 8 | +-*/\"'`^%&,;|_(){}<>[]=?! special symbols 9 | 10 | next line 11 | word_at_end 12 | -------------------------------------------------------------------------------- /test/vis/motions/next-start-of-bigword.keys: -------------------------------------------------------------------------------- 1 | f_Wr|+ 2 | ;W.+ 3 | ;W.+ 4 | 0W.+ 5 | 0W.+ 6 | 4W.+ 7 | W.+ 8 | W.+ 9 | W 10 | .+ 11 | Wi| 12 | -------------------------------------------------------------------------------- /test/vis/motions/next-start-of-bigword.ref: -------------------------------------------------------------------------------- 1 | _start-word |ext 2 | mid_dle-word |ext 3 | end-word_ |ext 4 | |tarting from a space 5 | |tarting from a tab 6 | a b c d | single letter words 7 | tab |ext 8 | +-*/\"'`^%&,;|_(){}<>[]=?! |pecial symbols 9 | 10 | |ext line 11 | word_at_end 12 | | 13 | -------------------------------------------------------------------------------- /test/vis/motions/next-start-of-word.in: -------------------------------------------------------------------------------- 1 | _start next 2 | mid_dle next 3 | end_ next 4 | starting from a space 5 | starting from a tab 6 | a b c d : single letter words 7 | tab next 8 | +-*/\"'`^%&,;|_(){}<>[]=?! special symbols 9 | word with count 10 | 11 | next line 12 | word_at_end 13 | -------------------------------------------------------------------------------- /test/vis/motions/next-start-of-word.keys: -------------------------------------------------------------------------------- 1 | f_wr|+ 2 | ;w.+ 3 | ;w.+ 4 | 0w.+ 5 | 0w.+ 6 | 4w.+ 7 | w.+ 8 | w.+ 9 | 2w.+ 10 | w 11 | .+ 12 | wi| 13 | -------------------------------------------------------------------------------- /test/vis/motions/next-start-of-word.ref: -------------------------------------------------------------------------------- 1 | _start |ext 2 | mid_dle |ext 3 | end_ |ext 4 | |tarting from a space 5 | |tarting from a tab 6 | a b c d | single letter words 7 | tab |ext 8 | +-*/\"'`^%&,;||(){}<>[]=?! special symbols 9 | word with |ount 10 | 11 | |ext line 12 | word_at_end 13 | | 14 | -------------------------------------------------------------------------------- /test/vis/motions/percent.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | -------------------------------------------------------------------------------- /test/vis/motions/percent.keys: -------------------------------------------------------------------------------- 1 | 50%i= 2 | 1%i| 3 | 100%. 4 | -------------------------------------------------------------------------------- /test/vis/motions/percent.ref: -------------------------------------------------------------------------------- 1 | |1 2 | 2 3 | 3= 4 | 4 5 | 5 6 | | -------------------------------------------------------------------------------- /test/vis/motions/prev-end-of-bigword.in: -------------------------------------------------------------------------------- 1 | 2 | prev WORD-end_ 3 | prev WORD-mid_dle 4 | prev WORD-word _start 5 | prev WORD-tab _ 6 | starting from a space 7 | starting from a tab 8 | single letter words a b c d _ 9 | special +-*/\"'`^%&,;|_(){}<>[]=?! 10 | prev WORD-word with count _ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-end-of-bigword.keys: -------------------------------------------------------------------------------- 1 | dgE+ 2 | f_gEr|+ 3 | ;gE.+ 4 | ;gE.+ 5 | ;gE.+ 6 | $hgE.+ 7 | $hgE.+ 8 | g_4gE.+ 9 | $2gE.+ 10 | ;3gE.+ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-end-of-bigword.ref: -------------------------------------------------------------------------------- 1 | 2 | pre| WORD-end_ 3 | pre| WORD-mid_dle 4 | prev WORD-wor| _start 5 | prev WORD-ta| _ 6 | starting from a spac| 7 | starting from a ta| 8 | single letter words | b c d _ 9 | specia| +-*/\"'`^%&,;|_(){}<>[]=?! 10 | prev WORD-wor| with count _ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-end-of-word.in: -------------------------------------------------------------------------------- 1 | 2 | prev word end_ 3 | prev word mid_dle 4 | prev word _start 5 | prev word tab _ 6 | starting from a space 7 | starting from a tab 8 | single letter words a b c d _ 9 | special +-*/\"'`^%&,;|_(){}<>[]=?! 10 | prev word with count _ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-end-of-word.keys: -------------------------------------------------------------------------------- 1 | dge+ 2 | f_ger|+ 3 | ;ge.+ 4 | ;ge.+ 5 | ;ge.+ 6 | $hge.+ 7 | $hge.+ 8 | g_4ge.+ 9 | g_ge.+ 10 | ;3ge.+ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-end-of-word.ref: -------------------------------------------------------------------------------- 1 | 2 | prev wor| end_ 3 | prev wor| mid_dle 4 | prev wor| _start 5 | prev word ta| _ 6 | starting from a spac| 7 | starting from a ta| 8 | single letter words | b c d _ 9 | special +-*/\"'`^%&,;||(){}<>[]=?! 10 | prev wor| with count _ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-start-of-bigword.in: -------------------------------------------------------------------------------- 1 | prev WORD-end_ 2 | prev WORD-mid_dle 3 | prev WORD-word _start 4 | prev WORD-tab _ 5 | starting from space 6 | starting from tab 7 | single letter words a b c d _ 8 | special symbols +-*/\"'`^%&,;|_(){}<>[]=?! 9 | prev WORD-word with count _ 10 | -------------------------------------------------------------------------------- /test/vis/motions/prev-start-of-bigword.keys: -------------------------------------------------------------------------------- 1 | dB 2 | f_Br|+ 3 | ;B.+ 4 | ;B.+ 5 | ;B.+ 6 | $hB.+ 7 | $hB.+ 8 | g_4B.+ 9 | $B.+ 10 | ;3B.+ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-start-of-bigword.ref: -------------------------------------------------------------------------------- 1 | prev |ORD-end_ 2 | prev |ORD-mid_dle 3 | prev |ORD-word _start 4 | prev |ORD-tab _ 5 | starting from |pace 6 | starting from |ab 7 | single letter words | b c d _ 8 | special symbols |-*/\"'`^%&,;|_(){}<>[]=?! 9 | prev |ORD-word with count _ 10 | -------------------------------------------------------------------------------- /test/vis/motions/prev-start-of-word.in: -------------------------------------------------------------------------------- 1 | prev word-end_ 2 | prev word-mid_dle 3 | prev word-word _start 4 | prev word-tab _ 5 | starting from space 6 | starting from tab 7 | single letter words a b c d _ 8 | special symbols +-*/\"'`^%&,;|_(){}<>[]=?! 9 | prev word-word with count _ 10 | -------------------------------------------------------------------------------- /test/vis/motions/prev-start-of-word.keys: -------------------------------------------------------------------------------- 1 | db 2 | f_br|+ 3 | ;b.+ 4 | ;b.+ 5 | ;b.+ 6 | $hb.+ 7 | $hb.+ 8 | g_4b.+ 9 | $b.+ 10 | ;3b.+ 11 | -------------------------------------------------------------------------------- /test/vis/motions/prev-start-of-word.ref: -------------------------------------------------------------------------------- 1 | prev word-|nd_ 2 | prev word-|id_dle 3 | prev word-|ord _start 4 | prev word-|ab _ 5 | starting from |pace 6 | starting from |ab 7 | single letter words | b c d _ 8 | special symbols +-*/\"'`^%&,;|_|){}<>[]=?! 9 | prev word-|ord with count _ 10 | -------------------------------------------------------------------------------- /test/vis/motions/till-left.in: -------------------------------------------------------------------------------- 1 | T{char} Till after [count]'th occurrence of {char} to the left. 2 | 1 till char c (T) 3 | 2 till char c with count (2T) 4 | 3 till char c using repeat and count (2;) 5 | 4 till char c in reverse direction with count (^2,) 6 | 5 till consecutive char ### with count (3T) 7 | 6 till consecutive char ### using repeat (;;;) 8 | 7 till consecutive char ### using repeat and count (3;) 9 | 8 till consecutive char ### in reverse direction with count (^3,) 10 | 9 delete # found (d;) 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 till æ unicode 14 | 13 till space 15 | 14 till tab 16 | -------------------------------------------------------------------------------- /test/vis/motions/till-left.keys: -------------------------------------------------------------------------------- 1 | + 2 | $Tcr|+ 3 | $2Tc.+ 4 | $2;.+ 5 | ^2,.+ 6 | $3T#.+ 7 | $;;;.+ 8 | $3;.+ 9 | ^3,.+ 10 | $d;+ 11 | $d;+ 12 | $d2;+ 13 | $Tær|+ 14 | $T.+ 15 | $T.+ 16 | -------------------------------------------------------------------------------- /test/vis/motions/till-left.ref: -------------------------------------------------------------------------------- 1 | T{char} Till after [count]'th occurrence of {char} to the left. 2 | 1 till char c|(T) 3 | 2 till char c|with count (2T) 4 | 3 till char c|using repeat and count (2;) 5 | 4 till char|c in reverse direction with count (^2,) 6 | 5 till consecutive char #|# with count (3T) 7 | 6 till consecutive char #|# using repeat (;;;) 8 | 7 till consecutive char #|# using repeat and count (3;) 9 | 8 till consecutive char #|# in reverse direction with count (^3,) 10 | 9 delete # 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 till æ|unicode 14 | 13 till |pace 15 | 14 till |tab 16 | -------------------------------------------------------------------------------- /test/vis/motions/till-right.in: -------------------------------------------------------------------------------- 1 | t{char} Till before [count]'th occurrence of {char} to the right. 2 | 1 till char c (t) 3 | 2 till char c with count (2t) 4 | 3 till char c using repeat and count (2;) 5 | 4 till char c in reverse direction with count ($3,) 6 | 5 till consecutive char ### with count (3t#) 7 | 6 till consecutive char ### using repeat (;;;) 8 | 7 till consecutive char ### using repeat and count (3;) 9 | 8 till consecutive char ### in reverse direction with count ($3,) 10 | 9 delete # found (d;) 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 till unicode æ 14 | 13 till space 15 | 14 till tab 16 | -------------------------------------------------------------------------------- /test/vis/motions/till-right.keys: -------------------------------------------------------------------------------- 1 | + 2 | tcr|+ 3 | 2tc.+ 4 | 2;.+ 5 | $3,.+ 6 | 3t#.+ 7 | ;;;.+ 8 | 3;.+ 9 | $3,.+ 10 | d;+ 11 | d;+ 12 | d2;+ 13 | tær|+ 14 | t.+ 15 | t.+ 16 | -------------------------------------------------------------------------------- /test/vis/motions/till-right.ref: -------------------------------------------------------------------------------- 1 | t{char} Till before [count]'th occurrence of {char} to the right. 2 | 1 till|char c (t) 3 | 2 till char|c with count (2t) 4 | 3 till char|c using repeat and count (2;) 5 | 4 till char c|in reverse direction with count ($3,) 6 | 5 till consecutive char #|# with count (3t#) 7 | 6 till consecutive char #|# using repeat (;;;) 8 | 7 till consecutive char #|# using repeat and count (3;) 9 | 8 till consecutive char #|# in reverse direction with count ($3,) 10 | # found (d;) 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 till unicode|æ 14 | 1| till space 15 | 14 till tab| 16 | -------------------------------------------------------------------------------- /test/vis/motions/to-left.in: -------------------------------------------------------------------------------- 1 | F{char} To [count]'th occurrence of {char} to the left. 2 | 1 find char c (F) 3 | 2 find char c with count (2F) 4 | 3 find char c using repeat and count (2;) 5 | 4 find char c in reverse direction with count (^2,) 6 | 5 find consecutive char ### with count (2F) 7 | 6 find consecutive char ### using repeat (;;) 8 | 7 find consecutive char ### using repeat and count (2;) 9 | 8 find consecutive char ### in reverse direction with count ($2,) 10 | 9 delete # found (d;) 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 till æ unicode 14 | 13 till space 15 | 14 till tab 16 | -------------------------------------------------------------------------------- /test/vis/motions/to-left.keys: -------------------------------------------------------------------------------- 1 | + 2 | $Fcr|+ 3 | $2Fc.+ 4 | $2;.+ 5 | ^2,.+ 6 | $2F#.+ 7 | $;;.+ 8 | $2;.+ 9 | ^2,.+ 10 | $d;+ 11 | $d;+ 12 | $d2;+ 13 | $Fær|+ 14 | $F.+ 15 | $F.+ 16 | -------------------------------------------------------------------------------- /test/vis/motions/to-left.ref: -------------------------------------------------------------------------------- 1 | F{char} To [count]'th occurrence of {char} to the left. 2 | 1 find char | (F) 3 | 2 find char | with count (2F) 4 | 3 find char | using repeat and count (2;) 5 | 4 find char | in reverse direction with count (^2,) 6 | 5 find consecutive char #|# with count (2F) 7 | 6 find consecutive char #|# using repeat (;;) 8 | 7 find consecutive char #|# using repeat and count (2;) 9 | 8 find consecutive char #|# in reverse direction with count ($2,) 10 | 9 delete 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 till | unicode 14 | 13 till|space 15 | 14 till | tab 16 | -------------------------------------------------------------------------------- /test/vis/motions/to-right.in: -------------------------------------------------------------------------------- 1 | f{char} To [count]'th occurrence of char to the right. 2 | 1 find char c (f) 3 | 2 find char c with count (2f) 4 | 3 find char c using repeat and count (2;) 5 | 4 find char c in reverse direction with count ($3,) 6 | 5 find consecutive char ### with count (2f#) 7 | 6 find consecutive char ### using repeat (;;) 8 | 7 find consecutive char ### using repeat and count (2;) 9 | 8 find consecutive char ### in reverse direction with count ($2,) 10 | 9 delete # found (d;) 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 find unicode æ 14 | 13 find space 15 | 14 find tab 16 | -------------------------------------------------------------------------------- /test/vis/motions/to-right.keys: -------------------------------------------------------------------------------- 1 | + 2 | fcr|+ 3 | 2fc.+ 4 | 2;.+ 5 | $3,.+ 6 | 2f#.+ 7 | ;;.+ 8 | 2;.+ 9 | $2,.+ 10 | d;+ 11 | d;+ 12 | d2;+ 13 | fær|+ 14 | f.+ 15 | f.+ 16 | -------------------------------------------------------------------------------- /test/vis/motions/to-right.ref: -------------------------------------------------------------------------------- 1 | f{char} To [count]'th occurrence of char to the right. 2 | 1 find |har c (f) 3 | 2 find char | with count (2f) 4 | 3 find char | using repeat and count (2;) 5 | 4 find char | in reverse direction with count ($3,) 6 | 5 find consecutive char #|# with count (2f#) 7 | 6 find consecutive char #|# using repeat (;;) 8 | 7 find consecutive char #|# using repeat and count (2;) 9 | 8 find consecutive char #|# in reverse direction with count ($2,) 10 | found (d;) 11 | 10 delete not found (d;) 12 | 11 delete invalid count # (d2;) 13 | 12 find unicode | 14 | 13|find space 15 | 14 find tab | 16 | -------------------------------------------------------------------------------- /test/vis/prompt/history.in: -------------------------------------------------------------------------------- 1 | line 1 2 | line 2 3 | line 3 4 | -------------------------------------------------------------------------------- /test/vis/prompt/history.keys: -------------------------------------------------------------------------------- 1 | :-0+0x/line/c/word/ 2 | :2l 3 | : 4 | :e 5 | :3l 6 | : 7 | -------------------------------------------------------------------------------- /test/vis/prompt/history.ref: -------------------------------------------------------------------------------- 1 | word 1 2 | word 2 3 | word 3 4 | -------------------------------------------------------------------------------- /test/vis/selections/align-indent-columns.in: -------------------------------------------------------------------------------- 1 | 1 2 2 | 3 4 3 | 5 6 4 | 7 8 5 | 9 10 6 | -------------------------------------------------------------------------------- /test/vis/selections/align-indent-columns.keys: -------------------------------------------------------------------------------- 1 | :x/[0-9]+ 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/vis/selections/align-indent-columns.ref: -------------------------------------------------------------------------------- 1 | 1 2 2 | 3 4 3 | 5 6 4 | 7 8 5 | 9 10 6 | -------------------------------------------------------------------------------- /test/vis/selections/align-indent.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | -------------------------------------------------------------------------------- /test/vis/selections/align-indent.keys: -------------------------------------------------------------------------------- 1 | vGI 2 | i| 3 | -------------------------------------------------------------------------------- /test/vis/selections/align-indent.ref: -------------------------------------------------------------------------------- 1 | |1 2 | |2 3 | |3 4 | |4 5 | |5 6 | -------------------------------------------------------------------------------- /test/vis/selections/align.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | -------------------------------------------------------------------------------- /test/vis/selections/align.keys: -------------------------------------------------------------------------------- 1 | vGI 2 | 3 | i| 4 | -------------------------------------------------------------------------------- /test/vis/selections/align.ref: -------------------------------------------------------------------------------- 1 | |1 2 | | 2 3 | | 3 4 | | 4 5 | | 5 6 | -------------------------------------------------------------------------------- /test/vis/selections/complement-whole.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/complement-whole.keys: -------------------------------------------------------------------------------- 1 | :x 2 | ~ 3 | :i/|/ 4 | -------------------------------------------------------------------------------- /test/vis/selections/complement-whole.ref: -------------------------------------------------------------------------------- 1 | 1| 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/complement.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/complement.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ x/./ g2 2 | ~ 3 | :y/\n/ 4 | :v-1 { i/[/ a/]/ } 5 | -------------------------------------------------------------------------------- /test/vis/selections/complement.ref: -------------------------------------------------------------------------------- 1 | [1]0[0] 2 | [1]0[1] 3 | [1]0[2] 4 | [1]0[3] 5 | [1]0[4] 6 | [1]0[5] 7 | [1]0[6] 8 | [1]0[7] 9 | [1]0[8] 10 | [1]0[9] 11 | -------------------------------------------------------------------------------- /test/vis/selections/end-of-file.in: -------------------------------------------------------------------------------- 1 | 01 2 | 3 | 12 4 | 5 | 23 6 | 7 | 34 8 | 9 | 4 10 | -------------------------------------------------------------------------------- /test/vis/selections/end-of-file.keys: -------------------------------------------------------------------------------- 1 | Gll 2 | 3 | i5 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/vis/selections/end-of-file.ref: -------------------------------------------------------------------------------- 1 | 01 2 | 3 | 12 4 | 5 | 23 6 | 7 | 34 8 | 9 | 45 10 | 11 | 5 12 | 13 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-adjacent.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-adjacent.keys: -------------------------------------------------------------------------------- 1 | :x g%2 2 | m 3 | :x v%2 4 | & 5 | :i/|/ 6 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-adjacent.ref: -------------------------------------------------------------------------------- 1 | 1| 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-contained.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-contained.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ x/./ g2 2 | m 3 | :x/.*/ g%2 4 | & 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-contained.ref: -------------------------------------------------------------------------------- 1 | 100 2 | 1[0]1 3 | 102 4 | 1[0]3 5 | 104 6 | 1[0]5 7 | 106 8 | 1[0]7 9 | 108 10 | 1[0]9 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-empty.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-empty.keys: -------------------------------------------------------------------------------- 1 | :x v%2 2 | & 3 | :i/|/ 4 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-empty.ref: -------------------------------------------------------------------------------- 1 | 100| 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-overlapping.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-overlapping.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ x/^../ 2 | m 3 | :x/.*/ x/..$/ 4 | & 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-overlapping.ref: -------------------------------------------------------------------------------- 1 | 1[0]0 2 | 1[0]1 3 | 1[0]2 4 | 1[0]3 5 | 1[0]4 6 | 1[0]5 7 | 1[0]6 8 | 1[0]7 9 | 1[0]8 10 | 1[0]9 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-whole.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-whole.keys: -------------------------------------------------------------------------------- 1 | :, 2 | m 3 | :x/.*/ v%2 4 | & 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/intersect-whole.ref: -------------------------------------------------------------------------------- 1 | [100] 2 | 101 3 | [102] 4 | 103 5 | [104] 6 | 105 7 | [106] 8 | 107 9 | [108] 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-adjacent.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-adjacent.keys: -------------------------------------------------------------------------------- 1 | :x g%2 2 | m 3 | :x v%2 4 | \ 5 | :i/* / 6 | -------------------------------------------------------------------------------- /test/vis/selections/minus-adjacent.ref: -------------------------------------------------------------------------------- 1 | * 1 2 | 2 3 | * 3 4 | 4 5 | * 5 6 | 6 7 | * 7 8 | 8 9 | * 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-contained.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-contained.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ x/./ g2 2 | m 3 | :x/.*/ g%2 4 | \ 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/minus-contained.ref: -------------------------------------------------------------------------------- 1 | 100 2 | [1]0[1] 3 | 102 4 | [1]0[3] 5 | 104 6 | [1]0[5] 7 | 106 8 | [1]0[7] 9 | 108 10 | [1]0[9] 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-empty.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-empty.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ v%2 2 | \ 3 | :{ i/[/ a/]/ } 4 | -------------------------------------------------------------------------------- /test/vis/selections/minus-empty.ref: -------------------------------------------------------------------------------- 1 | [100] 2 | 101 3 | [102] 4 | 103 5 | [104] 6 | 105 7 | [106] 8 | 107 9 | [108] 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-overlapping.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-overlapping.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ x/^../ 2 | m 3 | :x/.*/ x/..$/ 4 | \ 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/minus-overlapping.ref: -------------------------------------------------------------------------------- 1 | 10[0] 2 | 10[1] 3 | 10[2] 4 | 10[3] 5 | 10[4] 6 | 10[5] 7 | 10[6] 8 | 10[7] 9 | 10[8] 10 | 10[9] 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-whole.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/minus-whole.keys: -------------------------------------------------------------------------------- 1 | :, 2 | m 3 | :x v%2 4 | \ 5 | :i/|/ 6 | -------------------------------------------------------------------------------- /test/vis/selections/minus-whole.ref: -------------------------------------------------------------------------------- 1 | 100| 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/new-above-first-below-last.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | -------------------------------------------------------------------------------- /test/vis/selections/new-above-first-below-last.keys: -------------------------------------------------------------------------------- 1 | /3 2 | 2 3 | 2 4 | i> 5 | -------------------------------------------------------------------------------- /test/vis/selections/new-above-first-below-last.ref: -------------------------------------------------------------------------------- 1 | >1 2 | >2 3 | >3 4 | >4 5 | >5 6 | -------------------------------------------------------------------------------- /test/vis/selections/new-below-above.in: -------------------------------------------------------------------------------- 1 | 1 2 | 3 | 2 4 | 5 | 3 6 | -------------------------------------------------------------------------------- /test/vis/selections/new-below-above.keys: -------------------------------------------------------------------------------- 1 | 10 2 | iv 3 | g0 4 | 10 5 | i^ 6 | -------------------------------------------------------------------------------- /test/vis/selections/new-below-above.ref: -------------------------------------------------------------------------------- 1 | ^v1 2 | ^v 3 | ^v2 4 | ^v 5 | ^v3 6 | -------------------------------------------------------------------------------- /test/vis/selections/new-end-of-line.in: -------------------------------------------------------------------------------- 1 | 1 : first 2 | 2 : second 3 | 3 : third 4 | 4 : fourth 5 | -------------------------------------------------------------------------------- /test/vis/selections/new-end-of-line.keys: -------------------------------------------------------------------------------- 1 | vGA$ 2 | dT 3 | . 4 | dF 5 | Ibegin : 6 | . 7 | u 8 | -------------------------------------------------------------------------------- /test/vis/selections/new-end-of-line.ref: -------------------------------------------------------------------------------- 1 | begin : 1 2 | begin : 2 3 | begin : 3 4 | begin : 4 5 | -------------------------------------------------------------------------------- /test/vis/selections/new-start-of-line.in: -------------------------------------------------------------------------------- 1 | 1 : first 2 | 2 : second 3 | 3 : third 4 | 4 : fourth 5 | -------------------------------------------------------------------------------- /test/vis/selections/new-start-of-line.keys: -------------------------------------------------------------------------------- 1 | vGI 2 | df 3 | . 4 | A : end 5 | . 6 | u 7 | -------------------------------------------------------------------------------- /test/vis/selections/new-start-of-line.ref: -------------------------------------------------------------------------------- 1 | first : end 2 | second : end 3 | third : end 4 | fourth : end 5 | -------------------------------------------------------------------------------- /test/vis/selections/normal-mode-wq.in: -------------------------------------------------------------------------------- 1 | make 2 | sure 3 | :wq 4 | works 5 | when 6 | multiple 7 | cursors 8 | exist 9 | -------------------------------------------------------------------------------- /test/vis/selections/normal-mode-wq.keys: -------------------------------------------------------------------------------- 1 | vGI 2 | 3 | 4 | i 5 | -------------------------------------------------------------------------------- /test/vis/selections/normal-mode-wq.ref: -------------------------------------------------------------------------------- 1 | make 2 | sure 3 | :wq 4 | works 5 | when 6 | multiple 7 | cursors 8 | exist 9 | -------------------------------------------------------------------------------- /test/vis/selections/odd-even.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/odd-even.keys: -------------------------------------------------------------------------------- 1 | :x { g%2 i/+/ v%2 i/-/ } 2 | -------------------------------------------------------------------------------- /test/vis/selections/odd-even.ref: -------------------------------------------------------------------------------- 1 | -1 2 | +2 3 | -3 4 | +4 5 | -5 6 | +6 7 | -7 8 | +8 9 | -9 10 | +10 11 | -------------------------------------------------------------------------------- /test/vis/selections/out-of-view.keys: -------------------------------------------------------------------------------- 1 | :x/1$/ 2 | V 3 | 8j 4 | 8k 5 | d 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/vis/selections/remove-column.in: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | 4 5 6 3 | 7 8 9 4 | -------------------------------------------------------------------------------- /test/vis/selections/remove-column.keys: -------------------------------------------------------------------------------- 1 | :x/[0-9]+ 2 | 2 3 | :{ i/{/ a/}/ } 4 | 5 | : 6 | 2 7 | :{ i/>/ a/ 8 | 9 | -------------------------------------------------------------------------------- /test/vis/selections/remove-column.ref: -------------------------------------------------------------------------------- 1 | >1< {2} >3< 2 | >4< {5} >6< 3 | >7< {8} >9< 4 | -------------------------------------------------------------------------------- /test/vis/selections/select-match.in: -------------------------------------------------------------------------------- 1 | void print(char *msg) { 2 | printf("msg: %s\n", msg); 3 | } 4 | -------------------------------------------------------------------------------- /test/vis/selections/select-match.keys: -------------------------------------------------------------------------------- 1 | ?msg 2 | 3 | 4 | 5 | 6 | 7 | 8 | cinfo 9 | -------------------------------------------------------------------------------- /test/vis/selections/select-match.ref: -------------------------------------------------------------------------------- 1 | void print(char *info) { 2 | printf("msg: %s\n", info); 3 | } 4 | -------------------------------------------------------------------------------- /test/vis/selections/selections-rotate.in: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | 4 5 6 3 | 7 8 9 4 | -------------------------------------------------------------------------------- /test/vis/selections/selections-rotate.keys: -------------------------------------------------------------------------------- 1 | :x/[0-9]+ 2 | 2+ 3 | 2- 4 | + 5 | 2- 6 | 7 | -------------------------------------------------------------------------------- /test/vis/selections/selections-rotate.ref: -------------------------------------------------------------------------------- 1 | 2 3 1 2 | 5 6 4 3 | 8 9 7 4 | -------------------------------------------------------------------------------- /test/vis/selections/selections-trim.in: -------------------------------------------------------------------------------- 1 | 1, 2, 3 2 | 4, 5, 6 3 | 7, 8, 9 4 | -------------------------------------------------------------------------------- /test/vis/selections/selections-trim.keys: -------------------------------------------------------------------------------- 1 | :y/[,\n] 2 | 3 | 4 | _ 5 | :{ i/>/ a/ 6 | -------------------------------------------------------------------------------- /test/vis/selections/selections-trim.ref: -------------------------------------------------------------------------------- 1 | >1<, >2<, >3< 2 | >4<, >5<, >6< 3 | >7<, >8<, >9< 4 | -------------------------------------------------------------------------------- /test/vis/selections/union-adjacent.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-adjacent.keys: -------------------------------------------------------------------------------- 1 | :x g%2 2 | m 3 | :x v%2 4 | | 5 | :i/* / 6 | -------------------------------------------------------------------------------- /test/vis/selections/union-adjacent.ref: -------------------------------------------------------------------------------- 1 | * 1 2 | * 2 3 | * 3 4 | * 4 5 | * 5 6 | * 6 7 | * 7 8 | * 8 9 | * 9 10 | * 10 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-contained.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-contained.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ x/./ g2 2 | m 3 | :x/.*/ g%2 4 | | 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/union-contained.ref: -------------------------------------------------------------------------------- 1 | 1[0]0 2 | [101] 3 | 1[0]2 4 | [103] 5 | 1[0]4 6 | [105] 7 | 1[0]6 8 | [107] 9 | 1[0]8 10 | [109] 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-empty.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-empty.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ v%2 2 | | 3 | :{ i/[/ a/]/ } 4 | -------------------------------------------------------------------------------- /test/vis/selections/union-empty.ref: -------------------------------------------------------------------------------- 1 | [100] 2 | 101 3 | [102] 4 | 103 5 | [104] 6 | 105 7 | [106] 8 | 107 9 | [108] 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-overlapping.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-overlapping.keys: -------------------------------------------------------------------------------- 1 | :x/.*/ x/^../ 2 | m 3 | :x/.*/ x/..$/ 4 | | 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/union-overlapping.ref: -------------------------------------------------------------------------------- 1 | [100] 2 | [101] 3 | [102] 4 | [103] 5 | [104] 6 | [105] 7 | [106] 8 | [107] 9 | [108] 10 | [109] 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-whole.in: -------------------------------------------------------------------------------- 1 | 100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | -------------------------------------------------------------------------------- /test/vis/selections/union-whole.keys: -------------------------------------------------------------------------------- 1 | :, 2 | m 3 | :x v%2 4 | | 5 | :{ i/[/ a/]/ } 6 | -------------------------------------------------------------------------------- /test/vis/selections/union-whole.ref: -------------------------------------------------------------------------------- 1 | [100 2 | 101 3 | 102 4 | 103 5 | 104 6 | 105 7 | 106 8 | 107 9 | 108 10 | 109 11 | ] -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/marks.in: -------------------------------------------------------------------------------- 1 | The quick brown fox jumps over the lazy dog. 2 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/marks.keys: -------------------------------------------------------------------------------- 1 | :'a,'b { i/>/ a/ 2 | fq 3 | 'am 4 | el 5 | 'bm 6 | : 7 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/marks.ref: -------------------------------------------------------------------------------- 1 | The >quick< brown fox jumps over the lazy dog. 2 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/round-down.in: -------------------------------------------------------------------------------- 1 | static const KeyBinding bindings_basic[] = { 2 | { "", ACTION(EDITOR_SUSPEND) }, 3 | { "", ACTION(CURSOR_LINE_DOWN) }, 4 | { "", ACTION(CURSOR_LINE_END) }, 5 | { "", ACTION(CURSOR_LINE_BEGIN) }, 6 | { "", ACTION(CURSOR_CHAR_PREV) }, 7 | { "", ACTION(WINDOW_PAGE_DOWN) }, 8 | { "", ACTION(WINDOW_PAGE_UP) }, 9 | { "", ACTION(CURSOR_CHAR_NEXT) }, 10 | { "", ACTION(CURSOR_LONGWORD_START_PREV) }, 11 | { "", ACTION(WINDOW_HALFPAGE_DOWN) }, 12 | { "", ACTION(WINDOW_HALFPAGE_UP) }, 13 | { "", ACTION(CURSOR_LONGWORD_START_NEXT) }, 14 | { "", ACTION(CURSOR_LINE_UP) }, 15 | { 0 /* empty last element, array terminator */ }, 16 | }; 17 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/round-down.keys: -------------------------------------------------------------------------------- 1 | :/Left/,/Right/ 2 | :{ i/|/ a/|/ } 3 | :0/Left/,0/Right/ 4 | :-0+,+0- 5 | :{ i/>>\n/ a/<<\n/ } 6 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/round-down.ref: -------------------------------------------------------------------------------- 1 | static const KeyBinding bindings_basic[] = { 2 | { "", ACTION(EDITOR_SUSPEND) }, 3 | { "", ACTION(CURSOR_LINE_DOWN) }, 4 | { "", ACTION(CURSOR_LINE_END) }, 5 | { "", ACTION(CURSOR_LINE_BEGIN) }, 6 | { "<|Left>", ACTION(CURSOR_CHAR_PREV) }, 7 | >> 8 | { "", ACTION(WINDOW_PAGE_DOWN) }, 9 | { "", ACTION(WINDOW_PAGE_UP) }, 10 | << 11 | { "", ACTION(CURSOR_CHAR_NEXT) }, 12 | { "", ACTION(CURSOR_LONGWORD_START_PREV) }, 13 | { "", ACTION(WINDOW_HALFPAGE_DOWN) }, 14 | { "", ACTION(WINDOW_HALFPAGE_UP) }, 15 | { "", ACTION(CURSOR_LONGWORD_START_NEXT) }, 16 | { "", ACTION(CURSOR_LINE_UP) }, 17 | { 0 /* empty last element, array terminator */ }, 18 | }; 19 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/round-up.in: -------------------------------------------------------------------------------- 1 | static const KeyBinding bindings_basic[] = { 2 | { "", ACTION(EDITOR_SUSPEND) }, 3 | { "", ACTION(CURSOR_LINE_DOWN) }, 4 | { "", ACTION(CURSOR_LINE_END) }, 5 | { "", ACTION(CURSOR_LINE_BEGIN) }, 6 | { "", ACTION(CURSOR_CHAR_PREV) }, 7 | { "", ACTION(WINDOW_PAGE_DOWN) }, 8 | { "", ACTION(WINDOW_PAGE_UP) }, 9 | { "", ACTION(CURSOR_CHAR_NEXT) }, 10 | { "", ACTION(CURSOR_LONGWORD_START_PREV) }, 11 | { "", ACTION(WINDOW_HALFPAGE_DOWN) }, 12 | { "", ACTION(WINDOW_HALFPAGE_UP) }, 13 | { "", ACTION(CURSOR_LONGWORD_START_NEXT) }, 14 | { "", ACTION(CURSOR_LINE_UP) }, 15 | { 0 /* empty last element, array terminator */ }, 16 | }; 17 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/round-up.keys: -------------------------------------------------------------------------------- 1 | :/Left/,/Right/ 2 | :{ i/|/ a/|/ } 3 | :0/Left/,0/Right/ 4 | :-0,+0 5 | :{ i/>>\n/ a/<<\n/ } 6 | -------------------------------------------------------------------------------- /test/vis/structural-regex/addresses/round-up.ref: -------------------------------------------------------------------------------- 1 | static const KeyBinding bindings_basic[] = { 2 | { "", ACTION(EDITOR_SUSPEND) }, 3 | { "", ACTION(CURSOR_LINE_DOWN) }, 4 | { "", ACTION(CURSOR_LINE_END) }, 5 | { "", ACTION(CURSOR_LINE_BEGIN) }, 6 | >> 7 | { "<|Left>", ACTION(CURSOR_CHAR_PREV) }, 8 | { "", ACTION(WINDOW_PAGE_DOWN) }, 9 | { "", ACTION(WINDOW_PAGE_UP) }, 10 | { "", ACTION(CURSOR_CHAR_NEXT) }, 11 | << 12 | { "", ACTION(CURSOR_LONGWORD_START_PREV) }, 13 | { "", ACTION(WINDOW_HALFPAGE_DOWN) }, 14 | { "", ACTION(WINDOW_HALFPAGE_UP) }, 15 | { "", ACTION(CURSOR_LONGWORD_START_NEXT) }, 16 | { "", ACTION(CURSOR_LINE_UP) }, 17 | { 0 /* empty last element, array terminator */ }, 18 | }; 19 | -------------------------------------------------------------------------------- /test/vis/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export VIS_PATH=. 4 | export PATH="$(pwd)/../..:$PATH" 5 | export LANG="en_US.UTF-8" 6 | [ -z "$VIS" ] && VIS="../../vis" 7 | $VIS -v 8 | 9 | if ! $VIS -v | grep '+lua' >/dev/null 2>&1; then 10 | echo "vis compiled without lua support, skipping tests" 11 | exit 0 12 | fi 13 | 14 | TESTS_OK=0 15 | TESTS_RUN=0 16 | 17 | if [ $# -gt 0 ]; then 18 | test_files=$* 19 | else 20 | printf ':help\n:/ Lua paths/,$ w help\n:qall\n' | $VIS 2> /dev/null && cat help && rm -f help 21 | test_files="$(find . -type f -name '*.in')" 22 | fi 23 | 24 | for t in $test_files; do 25 | TESTS_RUN=$((TESTS_RUN + 1)) 26 | t=${t%.in} 27 | t=${t#./} 28 | $VIS '+qall!' "$t".in < /dev/null 2> /dev/null 29 | RETURN_CODE=$? 30 | 31 | printf "%-50s" "$t" 32 | if [ $RETURN_CODE -eq 0 -a -e "$t".out ]; then 33 | if cmp -s "$t".ref "$t".out 2> /dev/null; then 34 | printf "PASS\n" 35 | TESTS_OK=$((TESTS_OK + 1)) 36 | else 37 | printf "FAIL\n" 38 | diff -u "$t".ref "$t".out > "$t".err 39 | fi 40 | else 41 | printf "ERROR\n" 42 | fi 43 | done 44 | 45 | printf "Tests ok %d/%d\n" $TESTS_OK $TESTS_RUN 46 | 47 | # set exit status 48 | [ $TESTS_OK -eq $TESTS_RUN ] 49 | -------------------------------------------------------------------------------- /test/vis/text-objects/indentation.in: -------------------------------------------------------------------------------- 1 | static ssize_t write_all(int fd, const char *buf, size_t count) { 2 | size_t rem = count; 3 | while (rem > 0) { 4 | ssize_t written = write(fd, buf, rem); 5 | if (written < 0) { 6 | if (errno == EAGAIN || errno == EINTR) 7 | continue; 8 | return -1; 9 | } else if (written == 0) { 10 | break; 11 | } 12 | rem -= written; 13 | buf += written; 14 | } 15 | return count - rem; 16 | } 17 | -------------------------------------------------------------------------------- /test/vis/text-objects/indentation.keys: -------------------------------------------------------------------------------- 1 | /continue 2 | 3vi 3 | :x/^/ c/\/\/ 4 | 5 | -------------------------------------------------------------------------------- /test/vis/text-objects/indentation.ref: -------------------------------------------------------------------------------- 1 | static ssize_t write_all(int fd, const char *buf, size_t count) { 2 | size_t rem = count; 3 | while (rem > 0) { 4 | // ssize_t written = write(fd, buf, rem); 5 | // if (written < 0) { 6 | // if (errno == EAGAIN || errno == EINTR) 7 | // continue; 8 | // return -1; 9 | // } else if (written == 0) { 10 | // break; 11 | // } 12 | // rem -= written; 13 | // buf += written; 14 | } 15 | return count - rem; 16 | } 17 | -------------------------------------------------------------------------------- /test/vis/text-objects/lexer.in: -------------------------------------------------------------------------------- 1 | /* 2 | * cafe or tea? 3 | */ 4 | void drink() { 5 | printf("cafe: %d\n", 0xcafebeef); 6 | } 7 | -------------------------------------------------------------------------------- /test/vis/text-objects/lexer.keys: -------------------------------------------------------------------------------- 1 | :set syntax c 2 | :x/cafe 3 | ii 4 | :{ i/>/ a/ 5 | 6 | -------------------------------------------------------------------------------- /test/vis/text-objects/lexer.ref: -------------------------------------------------------------------------------- 1 | >/* 2 | * cafe or tea? 3 | */< 4 | void drink() { 5 | printf(>"cafe: %d\n"<, >0xcafebeef<); 6 | } 7 | -------------------------------------------------------------------------------- /test/vis/text-objects/line.in: -------------------------------------------------------------------------------- 1 | normal line 2 | normal line with white space 3 | normal line 4 | normal line with white space 5 | inner line 6 | inner line with white space 7 | -------------------------------------------------------------------------------- /test/vis/text-objects/line.keys: -------------------------------------------------------------------------------- 1 | dal 2 | . 3 | 2. 4 | cil>was an inner line< 5 | . 6 | j 7 | . 8 | g0i| 9 | $. 10 | -------------------------------------------------------------------------------- /test/vis/text-objects/line.ref: -------------------------------------------------------------------------------- 1 | >was an inner line< 2 | | >was an inner line< | 3 | -------------------------------------------------------------------------------- /test/vis/text-objects/search-result.in: -------------------------------------------------------------------------------- 1 | // add static using gn 2 | void f1(void); 3 | void f2(void); 4 | void f3(void); 5 | // add static using gN 6 | void f4(void); 7 | void f5(void); 8 | void f6(void); 9 | -------------------------------------------------------------------------------- /test/vis/text-objects/search-result.keys: -------------------------------------------------------------------------------- 1 | /void 2 | cgnstatic void 3 | 2. 4 | . 5 | G$ 6 | c2gNstatic void 7 | 3. 8 | . 9 | -------------------------------------------------------------------------------- /test/vis/text-objects/search-result.ref: -------------------------------------------------------------------------------- 1 | // add static using gn 2 | static void f1(void); 3 | static void f2(void); 4 | static void f3(void); 5 | // add static using gN 6 | static void f4(void); 7 | static void f5(void); 8 | static void f6(void); 9 | -------------------------------------------------------------------------------- /test/vis/visrc.lua: -------------------------------------------------------------------------------- 1 | package.path = '../../lua/?.lua;'..package.path 2 | dofile("../../lua/vis.lua") 3 | 4 | local function run_if_exists(luafile) 5 | local f = io.open(luafile, "r") 6 | if f ~= nil then 7 | f:close() 8 | dofile(luafile) 9 | end 10 | end 11 | 12 | vis.events.subscribe(vis.events.WIN_OPEN, function(win) 13 | -- test.in file passed to vis 14 | local name = win.file.name 15 | if name then 16 | -- use the corresponding test.lua file 17 | name = string.gsub(name, '%.in$', '') 18 | run_if_exists(string.format("%s.lua", name)) 19 | local file = io.open(string.format("%s.keys", name)) 20 | local keys = file:read('*all') 21 | keys = string.gsub(keys, '%s*\n', '') 22 | keys = string.gsub(keys, '', ' ') 23 | file:close() 24 | vis:feedkeys(keys..'') 25 | vis:command(string.format("w! '%s.out'", name)) 26 | end 27 | end) 28 | -------------------------------------------------------------------------------- /test/vis/visual-mode/orientation.in: -------------------------------------------------------------------------------- 1 | { { = } } 2 | -------------------------------------------------------------------------------- /test/vis/visual-mode/orientation.keys: -------------------------------------------------------------------------------- 1 | f= 2 | v2i{ 3 | 4 | i< 5 | gv 6 | o 7 | 8 | a> 9 | -------------------------------------------------------------------------------- /test/vis/visual-mode/orientation.ref: -------------------------------------------------------------------------------- 1 | { > { = } < } 2 | -------------------------------------------------------------------------------- /text-internal.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXT_INTERNAL 2 | #define TEXT_INTERNAL 3 | 4 | #include 5 | #include 6 | #include "text.h" 7 | 8 | /* Block holding the file content, either readonly mmap(2)-ed from the original 9 | * file or heap allocated to store the modifications. 10 | */ 11 | typedef struct { 12 | size_t size; /* maximal capacity */ 13 | size_t len; /* current used length / insertion position */ 14 | char *data; /* actual data */ 15 | enum { /* type of allocation */ 16 | BLOCK_TYPE_MMAP_ORIG, /* mmap(2)-ed from an external file */ 17 | BLOCK_TYPE_MMAP, /* mmap(2)-ed from a temporary file only known to this process */ 18 | BLOCK_TYPE_MALLOC, /* heap allocated block using malloc(3) */ 19 | } type; 20 | } Block; 21 | 22 | Block *block_alloc(size_t size); 23 | Block *block_read(size_t size, int fd); 24 | Block *block_mmap(size_t size, int fd, off_t offset); 25 | Block *block_load(int dirfd, const char *filename, enum TextLoadMethod method, struct stat *info); 26 | void block_free(Block*); 27 | bool block_capacity(Block*, size_t len); 28 | const char *block_append(Block*, const char *data, size_t len); 29 | bool block_insert(Block*, size_t pos, const char *data, size_t len); 30 | bool block_delete(Block*, size_t pos, size_t len); 31 | 32 | Block *text_block_mmaped(Text*); 33 | void text_saved(Text*, struct stat *meta); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /text-regex.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXT_REGEX_H 2 | #define TEXT_REGEX_H 3 | 4 | /* make the REG_* constants available */ 5 | #if CONFIG_TRE 6 | #include 7 | #else 8 | #include 9 | #endif 10 | #include "text.h" 11 | 12 | #define MAX_REGEX_SUB 10 13 | 14 | typedef struct Regex Regex; 15 | typedef Filerange RegexMatch; 16 | 17 | Regex *text_regex_new(void); 18 | int text_regex_compile(Regex*, const char *pattern, int cflags); 19 | size_t text_regex_nsub(Regex*); 20 | void text_regex_free(Regex*); 21 | int text_regex_match(Regex*, const char *data, int eflags); 22 | int text_search_range_forward(Text*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags); 23 | int text_search_range_backward(Text*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /text-util.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXT_UTIL_H 2 | #define TEXT_UTIL_H 3 | 4 | #include 5 | #include 6 | #include "text.h" 7 | 8 | /* test whether the given range is valid (start <= end) */ 9 | bool text_range_valid(const Filerange*); 10 | /* get the size of the range (end-start) or zero if invalid */ 11 | size_t text_range_size(const Filerange*); 12 | /* create an empty / invalid range of size zero */ 13 | Filerange text_range_empty(void); 14 | /* merge two ranges into a new one which contains both of them */ 15 | Filerange text_range_union(const Filerange*, const Filerange*); 16 | /* get intersection of two ranges */ 17 | Filerange text_range_intersect(const Filerange*, const Filerange*); 18 | /* create new range [min(a,b), max(a,b)] */ 19 | Filerange text_range_new(size_t a, size_t b); 20 | /* test whether two ranges are equal */ 21 | bool text_range_equal(const Filerange*, const Filerange*); 22 | /* test whether two ranges overlap */ 23 | bool text_range_overlap(const Filerange*, const Filerange*); 24 | /* test whether a given position is within a certain range */ 25 | bool text_range_contains(const Filerange*, size_t pos); 26 | /* count the number of graphemes in data */ 27 | int text_char_count(const char *data, size_t len); 28 | /* get the approximate display width of data */ 29 | int text_string_width(const char *data, size_t len); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /util.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_H 2 | #define UTIL_H 3 | 4 | #include 5 | #include 6 | 7 | #define LENGTH(x) ((int)(sizeof (x) / sizeof *(x))) 8 | #define MIN(a, b) ((a) > (b) ? (b) : (a)) 9 | #define MAX(a, b) ((a) < (b) ? (b) : (a)) 10 | 11 | /* is c the start of a utf8 sequence? */ 12 | #define ISUTF8(c) (((c)&0xC0)!=0x80) 13 | #define ISASCII(ch) ((unsigned char)ch < 0x80) 14 | 15 | #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000 16 | #define addu __builtin_add_overflow 17 | #else 18 | static inline bool addu(size_t a, size_t b, size_t *c) { 19 | if (SIZE_MAX - a < b) 20 | return false; 21 | *c = a + b; 22 | return true; 23 | } 24 | #endif 25 | 26 | #if !HAVE_MEMRCHR 27 | /* MIT licensed implementation from musl libc */ 28 | static void *memrchr(const void *m, int c, size_t n) 29 | { 30 | const unsigned char *s = m; 31 | c = (unsigned char)c; 32 | while (n--) if (s[n]==c) return (void *)(s+n); 33 | return 0; 34 | } 35 | #endif 36 | 37 | /* Needed for building on GNU Hurd */ 38 | 39 | #ifndef PIPE_BUF 40 | #define PIPE_BUF 4096 41 | #endif 42 | 43 | #ifndef PATH_MAX 44 | #define PATH_MAX 4096 45 | #endif 46 | 47 | #endif /* UTIL_H */ 48 | -------------------------------------------------------------------------------- /vis-lua.h: -------------------------------------------------------------------------------- 1 | #ifndef VIS_LUA_H 2 | #define VIS_LUA_H 3 | 4 | #if CONFIG_LUA 5 | #include 6 | #include 7 | #include 8 | 9 | #else 10 | typedef struct lua_State lua_State; 11 | typedef void* lua_CFunction; 12 | #endif 13 | 14 | #include "vis.h" 15 | #include "vis-subprocess.h" 16 | 17 | /* add a directory to consider when loading lua files */ 18 | bool vis_lua_path_add(Vis*, const char *path); 19 | /* get semicolon separated list of paths to load lua files 20 | * (*lpath = package.path) and Lua C modules (*cpath = package.cpath) 21 | * both these pointers need to be free(3)-ed by the caller */ 22 | bool vis_lua_paths_get(Vis*, char **lpath, char **cpath); 23 | 24 | /* various event handlers, triggered by the vis core */ 25 | #if !CONFIG_LUA 26 | #define vis_event_mode_insert_input vis_insert_key 27 | #define vis_event_mode_replace_input vis_replace_key 28 | #else 29 | void vis_event_mode_insert_input(Vis*, const char *key, size_t len); 30 | void vis_event_mode_replace_input(Vis*, const char *key, size_t len); 31 | #endif 32 | void vis_lua_process_response(Vis *, const char *, char *, size_t, ResponseType); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /vis-subprocess.h: -------------------------------------------------------------------------------- 1 | #ifndef VIS_SUBPROCESS_H 2 | #define VIS_SUBPROCESS_H 3 | #include "vis-core.h" 4 | #include "vis-lua.h" 5 | #include 6 | 7 | typedef struct Process Process; 8 | #if CONFIG_LUA 9 | typedef int Invalidator(lua_State*); 10 | #else 11 | typedef void Invalidator; 12 | #endif 13 | 14 | struct Process { 15 | char *name; 16 | int outfd; 17 | int errfd; 18 | int inpfd; 19 | pid_t pid; 20 | Invalidator** invalidator; 21 | Process *next; 22 | }; 23 | 24 | typedef enum { STDOUT, STDERR, SIGNAL, EXIT } ResponseType; 25 | 26 | Process *vis_process_communicate(Vis *, const char *command, const char *name, 27 | Invalidator **invalidator); 28 | int vis_process_before_tick(fd_set *); 29 | void vis_process_tick(Vis *, fd_set *); 30 | void vis_process_waitall(Vis *); 31 | #endif 32 | --------------------------------------------------------------------------------