linux-qubasis

linux oasis port as a qubes template

git clone https://9o.is/git/linux-qubasis.git

commit 3e1dfb2fd1028766f7cc85863a4a999d93a8e0a4
parent ed32c8b349446ff815c1f870b9abd36bafb30d95
Author: Jul <jul@9o.is>
Date:   Mon,  6 Oct 2025 11:43:35 +0800

add vis/lua/luaposix/lpeg/libtermkey

Diffstat:
M.gitmodules | 4++++
Mgen.sh | 5+++++
Mninja/functions.sh | 2+-
Apkg/libtermkey/gen.sh | 20++++++++++++++++++++
Apkg/lpeg/gen.sh | 18++++++++++++++++++
Apkg/lua/gen.sh | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/luaposix/config.h | 34++++++++++++++++++++++++++++++++++
Apkg/luaposix/gen.sh | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/luaposix/repo | 1+
Dpkg/vis/build | 45---------------------------------------------
Dpkg/vis/config.h | 356-------------------------------------------------------------------------------
Dpkg/vis/config/config/navigation.lua | 36------------------------------------
Dpkg/vis/config/config/picker.lua | 42------------------------------------------
Dpkg/vis/config/config/status.lua | 36------------------------------------
Dpkg/vis/config/plugins/commentary.lua | 147-------------------------------------------------------------------------------
Dpkg/vis/config/plugins/surround.lua | 192-------------------------------------------------------------------------------
Dpkg/vis/config/plugins/util.lua | 39---------------------------------------
Dpkg/vis/config/themes/default-16.lua | 59-----------------------------------------------------------
Dpkg/vis/config/visrc.lua | 16----------------
Apkg/vis/gen.sh | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/vis/lua.txt | 167+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dpkg/vis/patches/0001-use-system-clipboard-by-default.patch | 35-----------------------------------
Dpkg/vis/patches/0002-hide-prompt-on-escape-in-insert-mode.patch | 24------------------------
Mtpl/alpine-template/gen.sh | 2++
24 files changed, 484 insertions(+), 1028 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -110,3 +110,7 @@ path = pkg/yajl/repo url = https://github.com/lloyd/yajl ignore = all +[submodule "luaposix"] + path = pkg/luaposix/repo + url = https://github.com/luaposix/luaposix.git + ignore = all diff --git a/gen.sh b/gen.sh @@ -25,7 +25,11 @@ subgen pkg/byacc subgen pkg/e2fsprogs subgen pkg/fspec-sync subgen pkg/less +subgen pkg/libtermkey subgen pkg/linux-headers +subgen pkg/lpeg +subgen pkg/lua +subgen pkg/luaposix subgen pkg/mandoc subgen pkg/netbsd-curses subgen pkg/oksh @@ -39,6 +43,7 @@ subgen pkg/sbase subgen pkg/sinit subgen pkg/ubase subgen pkg/util-linux +subgen pkg/vis # subgen pkg/xen subgen pkg/xz-embedded # subgen pkg/yajl diff --git a/ninja/functions.sh b/ninja/functions.sh @@ -86,7 +86,7 @@ sym() { } reg() { - _out=$outdir/${1##*/} + _ninja_prefix _out $outdir $1 _ninja_fspec $2 reg ${3-0644} 0 0 $_out } diff --git a/pkg/libtermkey/gen.sh b/pkg/libtermkey/gen.sh @@ -0,0 +1,20 @@ +fetch curl http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.22.tar.gz \ + 6945bd3c4aaa83da83d80a045c5563da4edd7d0374c62c0d35aec09eb3014600 + +cflags " + -std=c99 + -I $pkgdir/netbsd-curses/include + -Wno-unused-parameter + -Wno-sign-compare + -Wno-implicit-fallthrough +" + +dep netbsd-curses/headers +headers termkey.h + +lib libtermkey.a " + termkey.c + driver-csi.c + driver-ti.c + $pkgdir/netbsd-curses/libcurses.a.d +" diff --git a/pkg/lpeg/gen.sh b/pkg/lpeg/gen.sh @@ -0,0 +1,18 @@ +fetch curl http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.1.0.tar.gz \ + 4b155d67d2246c1ffa7ad7bc466c1ea899bbc40fef0257cc9c03cecbaed4352a + +cflags " + -std=c99 + -isystem $pkgdir/lua/include +" + +dep lua/headers + +lib liblpeg.a " + lpvm.c + lpcap.c + lptree.c + lpcode.c + lpprint.c + lpcset.c +" diff --git a/pkg/lua/gen.sh b/pkg/lua/gen.sh @@ -0,0 +1,69 @@ +fetch curl http://www.lua.org/ftp/lua-5.4.7.tar.gz \ + 9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30 + +cflags " + -std=c99 + -D _DEFAULT_SOURCE + -D LUA_USE_POSIX + -D LUA_USE_JUMPTABLE=0 +" + +headers " + src/lua.h + src/luaconf.h + src/lualib.h + src/lauxlib.h +" + +lib liblua.a " + src/lapi.c + src/lauxlib.c + src/lbaselib.c + src/lcode.c + src/lcorolib.c + src/lctype.c + src/ldblib.c + src/ldebug.c + src/ldo.c + src/ldump.c + src/lfunc.c + src/lgc.c + src/linit.c + src/liolib.c + src/llex.c + src/lmathlib.c + src/lmem.c + src/loadlib.c + src/lobject.c + src/lopcodes.c + src/loslib.c + src/lparser.c + src/lstate.c + src/lstring.c + src/lstrlib.c + src/ltable.c + src/ltablib.c + src/ltm.c + src/lundump.c + src/lutf8lib.c + src/lvm.c + src/lzio.c +" + +exe lua " + src/lua.c + $outdir/liblua.a + $pkgdir/luaposix/libluaposix.a +" + +exe luac " + src/lua.c + $outdir/liblua.a +" + +reg lua /bin/lua5.4 0755 +sym lua5.4 /bin/lua +reg luac /bin/luac5.4 0755 +sym luac5.4 /bin/luac +man doc/lua.1 +man doc/luac.1 diff --git a/pkg/luaposix/config.h b/pkg/luaposix/config.h @@ -0,0 +1,34 @@ +#define PACKAGE "luaposix" +#define VERSION "v36.2.1" + +/* fcntl */ +#define HAVE_POSIX_FADVISE 1 + +/* sched */ +#define HAVE_SCHED_H 1 +#define HAVE_SCHED_GETSCHEDULER 1 +#define HAVE_SCHED_SETSCHEDULER 1 + +/* sys.msg */ +#define HAVE_SYS_MSG_H 1 +#define HAVE_MSGRCV 1 +#define HAVE_MSGSND 1 + +/* sys.socket */ +#define HAVE_NET_IF_H 1 +#define HAVE_LINUX_NETLINK_H 1 +#define HAVE_LINUX_IF_PACKET_H 1 + +/* sys.statvfs */ +#define HAVE_STATVFS 1 + +/* time */ +#define HAVE_TM_GMTOFF 1 +#define HAVE_TM_ZONE 1 + +/* unistd */ +#define HAVE_CRYPT 1 +#define HAVE_CRYPT_H 1 +#define HAVE_DECL_FDATASYNC 1 +#define HAVE_FDATASYNC 1 +#define HAVE_GETHOSTID 1 diff --git a/pkg/luaposix/gen.sh b/pkg/luaposix/gen.sh @@ -0,0 +1,67 @@ +fetch git + +cflags " + -std=c99 + -D _GNU_SOURCE + -include $dir/config.h + -I $srcdir/ext/include + -isystem $pkgdir/lua/include + -Wno-pedantic + -Wno-address + -Wno-unused-function + -Wno-unused-variable +" + +dep lua/headers + +build sed $outdir/version.lua $srcdir/lib/posix/version.lua.in +bind expr '-e s,@package@,luaposix, -e s,@version2,36.2.1,' + +lib libluaposix.a " + ext/posix/ctype.c + ext/posix/dirent.c + ext/posix/errno.c + ext/posix/fcntl.c + ext/posix/fnmatch.c + ext/posix/glob.c + ext/posix/grp.c + ext/posix/libgen.c + ext/posix/poll.c + ext/posix/pwd.c + ext/posix/sched.c + ext/posix/signal.c + ext/posix/stdio.c + ext/posix/stdlib.c + ext/posix/sys/msg.c + ext/posix/sys/resource.c + ext/posix/sys/socket.c + ext/posix/sys/stat.c + ext/posix/sys/statvfs.c + ext/posix/sys/time.c + ext/posix/sys/times.c + ext/posix/sys/utsname.c + ext/posix/sys/wait.c + ext/posix/syslog.c + ext/posix/termio.c + ext/posix/time.c + ext/posix/unistd.c + ext/posix/utime.c +" + +luapfile() { + for v in $*; do + reg $srcdir/lib/posix/$v /share/lua/5.4/posix/$v + done +} + +luapfile " + _base.lua + _bitwise.lua + _strict.lua + compat.lua + init.lua + sys.lua + util.lua +" + +reg version.lua /share/lua/5.4/posix/version.lua diff --git a/pkg/luaposix/repo b/pkg/luaposix/repo @@ -0,0 +1 @@ +Subproject commit ad9e0ee7d41a9fbde6861a970c96a79c097662e7 diff --git a/pkg/vis/build b/pkg/vis/build @@ -1,45 +0,0 @@ -#!/bin/sh -set -euo pipefail - -# require: -# - libtermkey-devel -# - lua-devel - -gitref="630693b" -repodir="$srcdir/repo" - -if [ "$skip_clean" != "true" ]; then - git -C "$repodir" clean -dx - git -C "$repodir" reset --hard "$gitref" - - for patch in $srcdir/patches/*.patch; do - git -C "$repodir" am --no-gpg-sign "$patch" - done -fi - -( - cd $repodir - ./configure \ - --prefix=/usr \ - --enable-curses \ - --enable-lua -) - -rm -rf "$outdir" -cp "$srcdir/config.h" "$repodir" - -make -C "$repodir" -make DESTDIR="$outdir" -C "$repodir" install - -configdir="$outdir/home/user/.config/vis" -mkdir -p "$configdir" -cp -r "$srcdir"/config/* "$configdir" - -if [ "$local_install" == "true" ]; then - sudo make -C "$repodir" install - - configdir="/home/user/.config/vis" - mkdir -p "$configdir" - cp -r "$srcdir"/config/* "$configdir" -fi - diff --git a/pkg/vis/config.h b/pkg/vis/config.h @@ -1,356 +0,0 @@ -/* Configure your desired default key bindings. */ - -#define ALIAS(name) .alias = name, -#define ACTION(id) .action = &vis_action[VIS_ACTION_##id], - -static const char *keymaps[] = { - NULL -}; - -static const KeyBinding bindings_basic[] = { - { "<C-z>", ACTION(EDITOR_SUSPEND) }, - { "<Down>", ACTION(CURSOR_LINE_DOWN) }, - { "<End>", ACTION(CURSOR_LINE_END) }, - { "<Home>", ACTION(CURSOR_LINE_BEGIN) }, - { "<Left>", ACTION(CURSOR_CHAR_PREV) }, - { "<PageDown>", ACTION(WINDOW_PAGE_DOWN) }, - { "<PageUp>", ACTION(WINDOW_PAGE_UP) }, - { "<Right>", ACTION(CURSOR_CHAR_NEXT) }, - { "<S-Left>", ACTION(CURSOR_LONGWORD_START_PREV) }, - { "<S-PageDown>", ACTION(WINDOW_HALFPAGE_DOWN) }, - { "<S-PageUp>", ACTION(WINDOW_HALFPAGE_UP) }, - { "<S-Right>", ACTION(CURSOR_LONGWORD_START_NEXT) }, - { "<Up>", ACTION(CURSOR_LINE_UP) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_motions[] = { - { "g|", ACTION(CURSOR_COLUMN) }, - { "[{", ACTION(CURSOR_BLOCK_START) }, - { "]}", ACTION(CURSOR_BLOCK_END) }, - { "[(", ACTION(CURSOR_PARENTHESIS_START) }, - { "])", ACTION(CURSOR_PARENTHESIS_END) }, - { "$", ACTION(CURSOR_LINE_END) }, - { "^", ACTION(CURSOR_LINE_START) }, - { "}", ACTION(CURSOR_PARAGRAPH_NEXT) }, - { "{", ACTION(CURSOR_PARAGRAPH_PREV) }, - { "%", ACTION(CURSOR_PERCENT) }, - { "#", ACTION(CURSOR_SEARCH_WORD_BACKWARD) }, - { "*", ACTION(CURSOR_SEARCH_WORD_FORWARD) }, - { ")", ACTION(CURSOR_SENTENCE_NEXT) }, - { "(", ACTION(CURSOR_SENTENCE_PREV) }, - { "?", ACTION(PROMPT_SEARCH_BACKWARD) }, - { "/", ACTION(PROMPT_SEARCH_FORWARD) }, - { ";", ACTION(TOTILL_REPEAT) }, - { ",", ACTION(TOTILL_REVERSE) }, - { "+", ALIAS("j^") }, - { "-", ALIAS("k^") }, - { "B", ACTION(CURSOR_LONGWORD_START_PREV) }, - { "b", ACTION(CURSOR_WORD_START_PREV) }, - { "E", ACTION(CURSOR_LONGWORD_END_NEXT) }, - { "e", ACTION(CURSOR_WORD_END_NEXT) }, - { "F", ACTION(TO_LINE_LEFT) }, - { "f", ACTION(TO_LINE_RIGHT) }, - { "go", ACTION(CURSOR_BYTE) }, - { "gH", ACTION(CURSOR_BYTE_LEFT) }, - { "gL", ACTION(CURSOR_BYTE_RIGHT) }, - { "gh", ACTION(CURSOR_CODEPOINT_PREV) }, - { "gl", ACTION(CURSOR_CODEPOINT_NEXT) }, - { "g0", ACTION(CURSOR_SCREEN_LINE_BEGIN) }, - { "g_", ACTION(CURSOR_LINE_FINISH) }, - { "G", ACTION(CURSOR_LINE_LAST) }, - { "g$", ACTION(CURSOR_SCREEN_LINE_END) }, - { "gE", ACTION(CURSOR_LONGWORD_END_PREV) }, - { "ge", ACTION(CURSOR_WORD_END_PREV) }, - { "gg", ACTION(CURSOR_LINE_FIRST) }, - { "gj", ACTION(CURSOR_SCREEN_LINE_DOWN) }, - { "gk", ACTION(CURSOR_SCREEN_LINE_UP) }, - { "gm", ACTION(CURSOR_SCREEN_LINE_MIDDLE) }, - { "h", ACTION(CURSOR_CHAR_PREV) }, - { "H", ACTION(CURSOR_WINDOW_LINE_TOP) }, - { "j", ACTION(CURSOR_LINE_DOWN) }, - { "k", ACTION(CURSOR_LINE_UP) }, - { "l", ACTION(CURSOR_CHAR_NEXT) }, - { "L", ACTION(CURSOR_WINDOW_LINE_BOTTOM) }, - { "M", ACTION(CURSOR_WINDOW_LINE_MIDDLE) }, - { "n", ACTION(CURSOR_SEARCH_REPEAT_FORWARD) }, - { "N", ACTION(CURSOR_SEARCH_REPEAT_BACKWARD) }, - { "T", ACTION(TILL_LINE_LEFT) }, - { "t", ACTION(TILL_LINE_RIGHT) }, - { "W", ACTION(CURSOR_LONGWORD_START_NEXT) }, - { "w", ACTION(CURSOR_WORD_START_NEXT) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_textobjects[] = { - { "a<", ACTION(TEXT_OBJECT_ANGLE_BRACKET_OUTER) }, - { "a`", ACTION(TEXT_OBJECT_BACKTICK_OUTER) }, - { "a{", ACTION(TEXT_OBJECT_CURLY_BRACKET_OUTER) }, - { "a(", ACTION(TEXT_OBJECT_PARENTHESIS_OUTER) }, - { "a\"", ACTION(TEXT_OBJECT_QUOTE_OUTER) }, - { "a\'", ACTION(TEXT_OBJECT_SINGLE_QUOTE_OUTER) }, - { "a[", ACTION(TEXT_OBJECT_SQUARE_BRACKET_OUTER) }, - { "a>", ALIAS("a<") }, - { "a)", ALIAS("a(") }, - { "a]", ALIAS("a[") }, - { "a}", ALIAS("a{") }, - { "ab", ALIAS("a(") }, - { "aB", ALIAS("a{") }, - { "al", ACTION(TEXT_OBJECT_LINE_OUTER) }, - { "ap", ACTION(TEXT_OBJECT_PARAGRAPH_OUTER) }, - { "as", ACTION(TEXT_OBJECT_SENTENCE) }, - { "a<Tab>", ACTION(TEXT_OBJECT_INDENTATION) }, - { "aW", ACTION(TEXT_OBJECT_LONGWORD_OUTER) }, - { "aw", ACTION(TEXT_OBJECT_WORD_OUTER) }, - { "gN", ACTION(TEXT_OBJECT_SEARCH_BACKWARD) }, - { "gn", ACTION(TEXT_OBJECT_SEARCH_FORWARD) }, - { "i<", ACTION(TEXT_OBJECT_ANGLE_BRACKET_INNER) }, - { "i`", ACTION(TEXT_OBJECT_BACKTICK_INNER) }, - { "i{", ACTION(TEXT_OBJECT_CURLY_BRACKET_INNER) }, - { "i(", ACTION(TEXT_OBJECT_PARENTHESIS_INNER) }, - { "i\"", ACTION(TEXT_OBJECT_QUOTE_INNER) }, - { "i\'", ACTION(TEXT_OBJECT_SINGLE_QUOTE_INNER) }, - { "i[", ACTION(TEXT_OBJECT_SQUARE_BRACKET_INNER) }, - { "i>", ALIAS("i<") }, - { "i)", ALIAS("i(") }, - { "i]", ALIAS("i[") }, - { "i}", ALIAS("i{") }, - { "ib", ALIAS("i(") }, - { "iB", ALIAS("i{") }, - { "il", ACTION(TEXT_OBJECT_LINE_INNER) }, - { "ip", ACTION(TEXT_OBJECT_PARAGRAPH) }, - { "is", ACTION(TEXT_OBJECT_SENTENCE) }, - { "i<Tab>", ACTION(TEXT_OBJECT_INDENTATION) }, - { "iW", ACTION(TEXT_OBJECT_LONGWORD_INNER) }, - { "iw", ACTION(TEXT_OBJECT_WORD_INNER) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_selections[] = { - { "m", ACTION(SELECTIONS_SAVE) }, - { "M", ACTION(SELECTIONS_RESTORE) }, - { "|", ACTION(SELECTIONS_UNION) }, - { "&", ACTION(SELECTIONS_INTERSECT) }, - { "~", ACTION(SELECTIONS_COMPLEMENT) }, - { "\\", ACTION(SELECTIONS_MINUS) }, - { "_", ACTION(SELECTIONS_TRIM) }, - { "<S-Tab>", ACTION(SELECTIONS_ALIGN_INDENT_RIGHT) }, - { "<Tab>", ACTION(SELECTIONS_ALIGN_INDENT_LEFT) }, - { "g<", ACTION(JUMPLIST_PREV) }, - { "gs", ACTION(JUMPLIST_SAVE) }, - { "g>", ACTION(JUMPLIST_NEXT) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_operators[] = { - { "0", ACTION(COUNT) }, - { "1", ACTION(COUNT) }, - { "2", ACTION(COUNT) }, - { "3", ACTION(COUNT) }, - { "4", ACTION(COUNT) }, - { "5", ACTION(COUNT) }, - { "6", ACTION(COUNT) }, - { "7", ACTION(COUNT) }, - { "8", ACTION(COUNT) }, - { "9", ACTION(COUNT) }, - { "=", ALIAS("<vis-prompt-show>|fmt<Enter>") }, - { "<", ACTION(OPERATOR_SHIFT_LEFT) }, - { ">", ACTION(OPERATOR_SHIFT_RIGHT) }, - { "\"", ACTION(REGISTER) }, - { "'", ACTION(MARK) }, - { "c", ACTION(OPERATOR_CHANGE) }, - { "d", ACTION(OPERATOR_DELETE) }, - { "g~", ALIAS("<vis-prompt-show>|tr '[:lower:][:upper:]' '[:upper:][:lower:]'<Enter>") }, - { "gu", ALIAS("<vis-prompt-show>|awk '{printf \"%s\", tolower($0)}'<Enter>")}, - { "gU", ALIAS("<vis-prompt-show>|awk '{printf \"%s\", toupper($0)}'<Enter>")}, - { "p", ACTION(PUT_AFTER) }, - { "P", ACTION(PUT_BEFORE) }, - { "y", ACTION(OPERATOR_YANK) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_normal[] = { - { "a", ACTION(APPEND_CHAR_NEXT) }, - { "A", ACTION(APPEND_LINE_END) }, - { "@", ACTION(MACRO_REPLAY) }, - { ":", ACTION(PROMPT_SHOW) }, - { ".", ACTION(REPEAT) }, - { "C", ALIAS("c$") }, - { "<C-b>", ALIAS("<PageUp>") }, - { "<C-c>", ACTION(SELECTIONS_REMOVE_COLUMN) }, - { "<C-d>", ACTION(SELECTIONS_NEXT) }, - { "<C-e>", ACTION(WINDOW_SLIDE_UP) }, - { "<C-f>", ALIAS("<PageDown>") }, - { "<C-j>", ACTION(SELECTIONS_NEW_LINE_BELOW) }, - { "<C-k>", ACTION(SELECTIONS_NEW_LINE_ABOVE) }, - { "<C-l>", ACTION(SELECTIONS_REMOVE_COLUMN_EXCEPT) }, - { "<C-n>", ALIAS("viw") }, - { "<C-p>", ACTION(SELECTIONS_REMOVE_LAST) }, - { "<C-r>", ACTION(REDO) }, - { "<C-u>", ACTION(SELECTIONS_PREV) }, - { "<C-w>c", ALIAS("<vis-prompt-show>q<Enter>") }, - { "<C-w>h", ALIAS("<C-w>k") }, - { "<C-w>j", ACTION(WINDOW_NEXT) }, - { "<C-w>k", ACTION(WINDOW_PREV) }, - { "<C-w>l", ALIAS("<C-w>j") }, - { "<C-w>n", ALIAS("<vis-prompt-show>open<Enter>") }, - { "<C-w>s", ALIAS("<vis-prompt-show>split<Enter>") }, - { "<C-w>v", ALIAS("<vis-prompt-show>vsplit<Enter>") }, - { "<C-y>", ACTION(WINDOW_SLIDE_DOWN) }, - { "D", ALIAS("d$") }, - { "<Escape>", ACTION(MODE_NORMAL_ESCAPE) }, - { "<F1>", ALIAS("<vis-prompt-show>help<Enter>") }, - { "ga", ACTION(UNICODE_INFO) }, - { "g8", ACTION(UTF8_INFO) }, - { "g-", ACTION(EARLIER) }, - { "g+", ACTION(LATER) }, - { "gn", ALIAS("vgn") }, - { "gN", ALIAS("vgN") }, - { "gv", ALIAS("v'^M") }, - { "I", ACTION(INSERT_LINE_START) }, - { "i", ACTION(MODE_INSERT) }, - { "J", ACTION(JOIN_LINES) }, - { "gJ", ACTION(JOIN_LINES_TRIM) }, - { "<M-C-j>", ACTION(SELECTIONS_NEW_LINE_BELOW_LAST) }, - { "<M-C-k>", ACTION(SELECTIONS_NEW_LINE_ABOVE_FIRST) }, - { "O", ACTION(OPEN_LINE_ABOVE) }, - { "o", ACTION(OPEN_LINE_BELOW) }, - { "q", ACTION(MACRO_RECORD) }, - { "R", ACTION(MODE_REPLACE) }, - { "r", ACTION(REPLACE_CHAR) }, - { "S", ALIAS("^c$") }, - { "s", ALIAS("cl") }, - { "<Tab>", ACTION(SELECTIONS_ALIGN) }, - { "u", ACTION(UNDO) }, - { "v", ACTION(MODE_VISUAL) }, - { "V", ACTION(MODE_VISUAL_LINE) }, - { "x", ACTION(DELETE_CHAR_NEXT) }, - { "X", ALIAS("dh") }, - { "Y", ALIAS("y$") }, - { "zb", ACTION(WINDOW_REDRAW_BOTTOM) }, - { "ZQ", ALIAS("<vis-prompt-show>q!<Enter>") }, - { "zt", ACTION(WINDOW_REDRAW_TOP) }, - { "zz", ACTION(WINDOW_REDRAW_CENTER) }, - { "ZZ", ALIAS("<vis-prompt-show>wq<Enter>") }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_visual[] = { - { "A", ACTION(SELECTIONS_NEW_LINES_END) }, - { "@", ACTION(MACRO_REPLAY) }, - { ":", ACTION(PROMPT_SHOW) }, - { "-", ACTION(SELECTIONS_ROTATE_LEFT) }, - { "+", ACTION(SELECTIONS_ROTATE_RIGHT) }, - { "<", ALIAS("<vis-operator-shift-left>gv") }, - { ">", ALIAS("<vis-operator-shift-right>gv") }, - { "<C-a>", ACTION(SELECTIONS_NEW_MATCH_ALL) }, - { "<C-b>", ALIAS("<PageUp>") }, - { "<C-c>", ACTION(SELECTIONS_REMOVE_COLUMN) }, - { "<C-d>", ACTION(SELECTIONS_NEXT) }, - { "<C-f>", ALIAS("<PageDown>") }, - { "<C-j>", ALIAS("<C-d>") }, - { "<C-k>", ALIAS("<C-u>") }, - { "<C-l>", ACTION(SELECTIONS_REMOVE_COLUMN_EXCEPT) }, - { "<C-n>", ACTION(SELECTIONS_NEW_MATCH_NEXT) }, - { "<C-p>", ACTION(SELECTIONS_REMOVE_LAST) }, - { "<C-u>", ACTION(SELECTIONS_PREV) }, - { "<C-x>", ACTION(SELECTIONS_NEW_MATCH_SKIP) }, - { "<Escape>", ACTION(MODE_VISUAL_ESCAPE) }, - { "I", ACTION(SELECTIONS_NEW_LINES_BEGIN) }, - { "J", ACTION(JOIN_LINES) }, - { "gJ", ACTION(JOIN_LINES_TRIM) }, - { "o", ACTION(SELECTION_FLIP) }, - { "q", ACTION(MACRO_RECORD) }, - { "r", ACTION(REPLACE_CHAR) }, - { "s", ALIAS("c") }, - { "u", ALIAS("gu<Escape>") }, - { "U", ALIAS("gU<Escape>") }, - { "V", ACTION(MODE_VISUAL_LINE) }, - { "v", ALIAS("<Escape>") }, - { "x", ALIAS("d") }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_visual_line[] = { - { "v", ACTION(MODE_VISUAL) }, - { "V", ACTION(MODE_NORMAL) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_readline[] = { - { "<Backspace>", ACTION(DELETE_CHAR_PREV) }, - { "<C-c>", ALIAS("<Escape>") }, - { "<C-d>", ACTION(DELETE_CHAR_NEXT) }, - { "<C-h>", ALIAS("<Backspace>") }, - { "<C-u>", ACTION(DELETE_LINE_BEGIN) }, - { "<C-v>", ACTION(INSERT_VERBATIM) }, - { "<C-w>", ACTION(DELETE_WORD_PREV) }, - { "<C-e>", ACTION(CURSOR_LINE_END) }, - { "<C-a>", ACTION(CURSOR_LINE_START) }, - { "<Delete>", ACTION(DELETE_CHAR_NEXT) }, - { "<Escape>", ACTION(MODE_NORMAL) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_insert[] = { - { "<C-d>", ALIAS("<vis-operator-shift-left><vis-operator-shift-left>") }, - { "<C-i>", ALIAS("<Tab>") }, - { "<C-j>", ALIAS("<vis-insert-verbatim>u000a") }, - { "<C-m>", ALIAS("<Enter>") }, - { "<C-r>", ACTION(INSERT_REGISTER) }, - { "<C-t>", ALIAS("<vis-operator-shift-right><vis-operator-shift-right>") }, - { "<C-x><C-e>", ACTION(WINDOW_SLIDE_UP) }, - { "<C-x><C-y>", ACTION(WINDOW_SLIDE_DOWN) }, - { "<Enter>", ACTION(INSERT_NEWLINE) }, - { "<Escape>", ACTION(MODE_NORMAL) }, - { "<S-Tab>", ACTION(SELECTIONS_ALIGN_INDENT_LEFT) }, - { "<Tab>", ACTION(INSERT_TAB) }, - { 0 /* empty last element, array terminator */ }, -}; - -static const KeyBinding bindings_replace[] = { - { 0 /* empty last element, array terminator */ }, -}; - -/* For each mode we list a all key bindings, if a key is bound in more than - * one array the first definition is used and further ones are ignored. */ -static const KeyBinding **default_bindings[] = { - [VIS_MODE_OPERATOR_PENDING] = (const KeyBinding*[]){ - bindings_operators, - bindings_textobjects, - bindings_motions, - bindings_basic, - NULL, - }, - [VIS_MODE_NORMAL] = (const KeyBinding*[]){ - bindings_normal, - bindings_selections, - bindings_operators, - bindings_motions, - bindings_basic, - NULL, - }, - [VIS_MODE_VISUAL] = (const KeyBinding*[]){ - bindings_visual, - bindings_selections, - bindings_textobjects, - bindings_operators, - bindings_motions, - bindings_basic, - NULL, - }, - [VIS_MODE_VISUAL_LINE] = (const KeyBinding*[]){ - bindings_visual_line, - NULL, - }, - [VIS_MODE_INSERT] = (const KeyBinding*[]){ - bindings_insert, - bindings_readline, - bindings_basic, - NULL, - }, - [VIS_MODE_REPLACE] = (const KeyBinding*[]){ - bindings_replace, - NULL, - }, -}; diff --git a/pkg/vis/config/config/navigation.lua b/pkg/vis/config/config/navigation.lua @@ -1,36 +0,0 @@ -require('vis') - -local util = require("plugins/util") - -local function count_windows() - local count = 0 - for _, _ in vis:windows() do - count = count + 1 - end - return count -end - -vis.events.subscribe(vis.events.INIT, function() - vis:map(vis.modes.NORMAL, '<M-Up>', '<C-w>k') - vis:map(vis.modes.NORMAL, '<M-Down>', '<C-w>j') - vis:map(vis.modes.NORMAL, '<M-Left>', '<C-w>h') - vis:map(vis.modes.NORMAL, '<M-Right>', '<C-w>l') - - vis:map(vis.modes.NORMAL, '<M-q>', function() - local closed = vis.win:close(false) - local modified = vis.win.file.modified - - if not closed then - if modified then - vis:info('Save changes before closing window') - elseif count_windows() == 1 then - vis:exit(0) - else - vis:info('Failed to close window') - end - end - end, 'Close current window') - - vis:map(vis.modes.NORMAL, '<C-t>', ':!echo "create \'fe -r vis\'" > $DVTM_CMD_FIFO<Enter>') -end) - diff --git a/pkg/vis/config/config/picker.lua b/pkg/vis/config/config/picker.lua @@ -1,42 +0,0 @@ -require("vis") - -local util = require("plugins/util") - -vis:command_register("pick", function(argv, force, win, selection, range) - local command = table.concat(argv, " ") - local file = io.popen(command) - local output = {} - for line in file:lines() do - table.insert(output, line) - end - local _, __, status = file:close() - - if status == 0 and output[1] ~= nil then - vis:feedkeys(string.format(":e '%s'<Enter>", output[1])) - end - - vis:feedkeys("<vis-redraw>") - return true; -end, "Pick files to open") - -function map(key, command, help) - vis:map(vis.modes.NORMAL, key, function() - vis:command(command) - end, help) -end - -vis.events.subscribe(vis.events.INIT, function() - map(",sf", "pick find -type f | fzy", "[S]earch [F]iles") - map(",sd", "pick fe $(find -type d | fzy)", "[S]earch [D]irectories") -end) - -vis.events.subscribe(vis.events.WIN_OPEN, function(win) - local function dir(command) - return string.format(command, util.dirname(win.file.name)) - end - - map("-", string.format("pick fe ./%s", win.file.name), "Explore files") - map(",ssf", dir("pick find %s -type f | fzy"), "[S]earch [S]ub-directory [F]iles") - map(",ssd", dir("pick fe $(find %s -type d | fzy)"), "[S]earch [S]ub-directory [D]irectories") -end) - diff --git a/pkg/vis/config/config/status.lua b/pkg/vis/config/config/status.lua @@ -1,36 +0,0 @@ -local mode_names = { - [vis.modes.NORMAL] = 'n', - [vis.modes.OPERATOR_PENDING] = 'o', - [vis.modes.INSERT] = 'i', - [vis.modes.REPLACE] = 'r', - [vis.modes.VISUAL] = 'v', - [vis.modes.VISUAL_LINE] = 'V', -} - -vis.events.subscribe(vis.events.WIN_STATUS, function(win) - local filename = win.file.name or '[No Name]' - local modified = win.file.modified and '+' or '' - local recording = vis.recording and '@' or '' - local mode = mode_names[vis.mode] - local line = win.selection.line - local total_lines = #win.file.lines - local scroll_percent = 0 - - if total_lines > 0 then - scroll_percent = math.floor((line / total_lines) * 100) - end - - win:status( - string.format("%s", filename), - string.format("%-2s %s%s%s %3d,%-4d %3d%%", - vis.input_queue, - modified, - recording, - mode, - win.selection.line, - win.selection.col, - scroll_percent - ) - ) -end) - diff --git a/pkg/vis/config/plugins/commentary.lua b/pkg/vis/config/plugins/commentary.lua @@ -1,147 +0,0 @@ --- --- vis-commentary --- - -local vis = _G.vis - -local comment_string = { - actionscript='//', ada='--', ansi_c='/*|*/', antlr='//', apdl='!', apl='#', - applescript='--', asp='\'', autoit=';', awk='#', b_lang='//', bash='#', - batch=':', bibtex='%', boo='#', chuck='//', cmake='#', coffeescript='#', - context='%', cpp='//', crystal='#', csharp='//', css='/*|*/', cuda='//', - dart='//', desktop='#', django='{#|#}', dmd='//', dockerfile='#', dot='//', - eiffel='--', elixir='#', erlang='%', faust='//', fennel=';;', fish='#', - forth='|\\', fortran='!', fsharp='//', gap='#', gettext='#', gherkin='#', - glsl='//', gnuplot='#', go='//', groovy='//', gtkrc='#', haskell='--', - html='<!--|-->', icon='#', idl='//', inform='!', ini='#', Io='#', - java='//', javascript='//', json='/*|*/', jsp='//', latex='%', ledger='#', - less='//', lilypond='%', lisp=';', logtalk='%', lua='--', makefile='#', - markdown='<!--|-->', matlab='#', moonscript='--', myrddin='//', - nemerle='//', nsis='#', objective_c='//', pascal='//', perl='#', php='//', - pico8='//', pike='//', pkgbuild='#', prolog='%', props='#', protobuf='//', - ps='%', pure='//', python='#', rails='#', rc='#', rebol=';', rest='.. ', - rexx='--', rhtml='<!--|-->', rstats='#', ruby='#', rust='//', sass='//', - scala='//', scheme=';', smalltalk='"|"', sml='(*)', snobol4='#', sql='#', - tcl='#', tex='%', text='', toml='#', vala='//', vb='\'', vbscript='\'', - verilog='//', vhdl='--', wsf='<!--|-->', xml='<!--|-->', yaml='#', zig='//', - nim='#', julia='#', rpmspec='#', caml='(*|*)' -} - --- escape all magic characters with a '%' -local function esc(str) - if not str then return "" end - return (str:gsub('[[.+*?$^()%%%]-]', '%%%0')) -end - --- escape '%' -local function pesc(str) - if not str then return "" end - return str:gsub('%%', '%%%%') -end - -local function rtrim(s) - local n = #s - while n > 0 and s:find("^%s", n) do n = n - 1 end - return s:sub(1, n) - end - -local function comment_line(lines, lnum, prefix, suffix) - if suffix ~= "" then suffix = " " .. suffix end - lines[lnum] = string.gsub(lines[lnum], - "(%s*)(.*)", - "%1" .. pesc(prefix) .. " %2" .. pesc(suffix)) -end - -local function uncomment_line(lines, lnum, prefix, suffix) - local match_str = "^(%s*)" .. esc(prefix) .. "%s?(.*)" .. esc(suffix) - local m = table.pack(lines[lnum]:match(match_str)) - lines[lnum] = m[1] .. rtrim(m[2]) -end - -local function is_comment(line, prefix) - return (line:match("^%s*(.+)"):sub(0, #prefix) == prefix) -end - -local function toggle_line_comment(lines, lnum, prefix, suffix) - if not lines or not lines[lnum] then return end - if not lines[lnum]:match("^%s*(.+)") then return end -- ignore empty lines - if is_comment(lines[lnum], prefix) then - uncomment_line(lines, lnum, prefix, suffix) - else - comment_line(lines, lnum, prefix, suffix) - end -end - --- if one line inside the block is not a comment, comment the block. --- only uncomment, if every single line is comment. -local function block_comment(lines, a, b, prefix, suffix) - local uncomment = true - for i=a,b do - if lines[i]:match("^%s*(.+)") and not is_comment(lines[i], prefix) then - uncomment = false - end - end - - if uncomment then - for i=a,b do - if lines[i]:match("^%s*(.+)") then - uncomment_line(lines, i, prefix, suffix) - end - end - else - for i=a,b do - if lines[i]:match("^%s*(.+)") then - comment_line(lines, i, prefix, suffix) - end - end - end -end - -vis:operator_new("gc", function(file, range, pos) - local comment = comment_string[vis.win.syntax] - local prefix, suffix = comment:match('^([^|]+)|?([^|]*)$') - if not prefix then return end - - local c = 0 - local i = 1 - local a = -1 - local b = -1 - for line in file:lines_iterator() do - local line_start = c - local line_finish = c + #line + 1 - if line_start < range.finish and line_finish > range.start then - if a == -1 then - a = i - b = i - else - b = i - end - end - c = line_finish - if c > range.finish then break end - i = i + 1 - end - block_comment(file.lines, a, b, prefix, suffix) - - return range.start -end, "Toggle comment on selected lines") - -vis:map(vis.modes.NORMAL, "gcc", function() - local win = vis.win - local lines = win.file.lines - local comment = comment_string[win.syntax] - if not comment then return end - local prefix, suffix = comment:match('^([^|]+)|?([^|]*)$') - if not prefix then return end - - for sel in win:selections_iterator() do - local lnum = sel.line - local col = sel.col - - toggle_line_comment(lines, lnum, prefix, suffix) - sel:to(lnum, col) -- restore cursor position - end - - win:draw() -end, "Toggle comment on a the current line") - diff --git a/pkg/vis/config/plugins/surround.lua b/pkg/vis/config/plugins/surround.lua @@ -1,192 +0,0 @@ --- SPDX-License-Identifier: GPL-3.0-or-later --- © 2020 Georgi Kirilov - -require("vis") -local vis = vis - -local progname = ... - -local M = { - prefix = {add = {"ys", "S"}, change = {"cs", "C"}, delete = {"ds", "D"}}, -} - -local builtin_textobjects = { - ["["] = {{ "[" , "]" }, id = 7}, -- +/VIS_TEXTOBJECT_OUTER_SQUARE_BRACKET vis.h - ["{"] = {{ "{" , "}" }, id = 9}, -- +/VIS_TEXTOBJECT_OUTER_CURLY_BRACKET vis.h - ["<"] = {{ "<" , ">" }, id = 11}, -- +/VIS_TEXTOBJECT_OUTER_ANGLE_BRACKET vis.h - ["("] = {{ "(" , ")" }, id = 13}, -- +/VIS_TEXTOBJECT_OUTER_PARENTHESIS vis.h - ['"'] = {{ '"' , '"' }, id = 15}, -- +/VIS_TEXTOBJECT_OUTER_QUOTE vis.h - ["'"] = {{ "'" , "'" }, id = 17}, -- +/VIS_TEXTOBJECT_OUTER_SINGLE_QUOTE vis.h - ["`"] = {{ "`" , "`" }, id = 19}, -- +/VIS_TEXTOBJECT_OUTER_BACKTICK vis.h - {{ "" , "" }, id = 28}, -- +/VIS_TEXTOBJECT_INVALID vis.h -} - -local aliases = {} -for key, data in pairs(builtin_textobjects) do - local pair = data[1] aliases[pair[2]] = key ~= pair[2] and data or nil -end -for alias, data in pairs(aliases) do - builtin_textobjects[alias] = data -end -for alias, key in pairs({ - B = "{", - b = "(", -}) do builtin_textobjects[alias] = builtin_textobjects[key] end - -local function get_pair(key) return builtin_textobjects[key] and builtin_textobjects[key][1] end - -local function take_param(_, d) - if d and type(d[3]) == "table" then - if #d[3] == 2 then - if table.concat(d[3]):find("\xef\xbf\xbd", 1, true) then - local status, out = vis:pipe(nil, nil, "vis-menu" .. (d[4] and " -p '" .. d[4] .. ":'" or "")) - if status == 0 then - local param = out:sub(1, -2) - return {d[3][1]:gsub("\xef\xbf\xbd", param), d[3][2]:gsub("\xef\xbf\xbd", param)} - end - else - return d[3] - end - end - else - return d - end -end - -local function adjust_spacing(file, range, d) - local padding = "" - if vis.mode == vis.modes.VISUAL_LINE then - padding = d[1] ~= "\n" and "\n" or padding - elseif vis.mode ~= vis.modes.VISUAL then - local trailing = file:content(range):match("(%s*)$") - if #trailing > 0 then - range.finish = range.finish - #trailing - end - end - return padding -end - -local function add(file, range, pos) - if range.finish <= range.start then return pos end - local d = take_param(vis.win, get_pair(M.key[1], pos)) - if not d then return pos end - local padding = adjust_spacing(file, range, d) - file:insert(range.finish, d[2] .. padding) - file:insert(range.start, d[1] .. padding) - return range.start -end - -local function escape(text) - return text:gsub("[][^$)(%%.*+?-]", "%%%0") -end - -local function delimiters_in_place(file, range, pos, key, get_padding) - local start, slen, finish, flen - if vis.mode == vis.modes.VISUAL_LINE then - local block = file:content(range) - vis.count = nil - local d = get_pair(key, range.start + block:find("\n", 1, true)) - if not (d and d[1] and d[2]) then return end - local d1, d2 = escape(d[1]), escape(d[2]) - local sl = table.pack(block:match("^()[ \t]*()" .. d1 .. "[ \t]-\n()")) - if #sl == 0 then - sl = table.pack(block:match("()[ \t]*()" .. d1 .. "[ \t]-()\n")) - end - local el = table.pack(block:match("()\n[ \t]*()" .. d2 .. "()[ \t]*\n$")) - if #el == 0 then - el = table.pack(block:match("\n[ \t]*()()" .. d2 .. "[ \t]*()[^\n]-\n$")) - end - if not (#sl > 0 and #el > 0) then return end - start = range.start + sl[get_padding and 1 or 2] - 1 - slen = get_padding and sl[3] - sl[1] or #d[1] - finish = range.start + el[get_padding and 1 or 2] - 1 - flen = get_padding and el[3] - el[1] or #d[2] - else - local d = get_pair(key, pos) - if not (d and d[1] and d[2]) then return end - if file:content(range.start, #d[1]):find(d[1], 1, true) - and file:content(range.finish - #d[2], #d[2]):find(d[2], 1, true) then - start, slen, finish, flen = range.start, #d[1], range.finish - #d[2], #d[2] - end - end - return start, slen, finish, flen -end - -local function change(file, range, pos) - if range.finish <= range.start then return pos end - local start, slen, finish, flen = delimiters_in_place(file, range, pos, M.key[1]) - if not start then return pos end - local n = take_param(vis.win, get_pair(M.key[2], pos)) - if not n then return pos end - file:delete(finish, flen) - file:insert(finish, n[2]) - file:delete(start, slen) - file:insert(start, n[1]) - if pos < range.start + slen then - return (pos < range.start + #n[1] and pos < range.start + slen - 1 or slen == 1) and pos or range.start + #n[1] - 1 - elseif pos >= range.finish - flen then - return (pos < range.finish - flen + #n[2] and pos < range.finish - 1) and pos - slen + #n[1] or range.finish - slen - flen + #n[1] + #n[2] - 1 - else - return pos - slen + #n[1] - end -end - -local function delete(file, range, pos) - if range.finish <= range.start then return pos end - local start, slen, finish, flen = delimiters_in_place(file, range, pos, M.key[1], true) - if not start then return pos end - file:delete(finish, flen) - file:delete(start, slen) - return range.start -end - -local function outer(key) - return builtin_textobjects[key] and builtin_textobjects[key].id or builtin_textobjects[1].id -end - -local function va_call(id, nargs, needs_range) - return function(keys) - if #keys < nargs then return -1 end - if #keys == nargs then - M.key = {} - for key in keys:gmatch(".") do table.insert(M.key, key) end - vis:operator(id) - if needs_range then - vis:textobject(outer(M.key[1])) - end - end - return #keys - end -end - -local function h(msg) - return string.format("|@%s| %s", progname, msg) -end - -local function operator_new(prefix, handler, nargs, help) - local id = vis:operator_register(handler) - if id < 0 then - return false - end - if type(prefix) == "table" then - local needs_range = ({[change] = true, [delete] = true})[handler] - if prefix[1] then vis:map(vis.modes.NORMAL, prefix[1], va_call(id, nargs, needs_range), h(help)) end - if prefix[2] then vis:map(vis.modes.VISUAL, prefix[2], va_call(id, nargs), h(help)) end - end - return id -end - -vis.events.subscribe(vis.events.INIT, function() - M.operator = { - add = operator_new(M.prefix.add, add, 1, "Add delimiters at range boundaries"), - change = operator_new(M.prefix.change, change, 2, "Change delimiters at range boundaries"), - delete = operator_new(M.prefix.delete, delete, 1, "Delete delimiters at range boundaries"), - } - local vis_pairs = package.loaded["pairs"] or package.loaded["vis-pairs"] - if vis_pairs then - get_pair = function(key, pos) return vis_pairs.get_pair(key, vis.win, pos) end - outer = function(key) vis_pairs.key = key return vis_pairs.textobject.outer end - end -end) - -return M diff --git a/pkg/vis/config/plugins/util.lua b/pkg/vis/config/plugins/util.lua @@ -1,39 +0,0 @@ -local M = {} - -M.dirname = function(pathname) - if pathname == nil then - return '.' - elseif type(pathname) ~= 'string' then - error('pathname must be string', 2) - end - - -- remove trailing-slashes - local head = string.find(pathname, '/+$', 2) - if head then - pathname = string.sub(pathname, 1, head - 1) - end - - -- remove last-segment - head = string.find(pathname, '[^/]+$') - if head then - pathname = string.sub(pathname, 1, head - 1) - end - - -- remove trailing-slashes - head = string.find(pathname, '/+$') - if head then - if head == 1 then - return '/' - end - pathname = string.sub(pathname, 1, head - 1) - end - - -- empty or dotted string - if string.find(pathname, '^%s*$') or string.find(pathname, '^%.+$') then - return '.' - end - - return pathname -end - -return M diff --git a/pkg/vis/config/themes/default-16.lua b/pkg/vis/config/themes/default-16.lua @@ -1,59 +0,0 @@ -local lexers = vis.lexers - -local colors = { - ['base00'] = '#181825', - ['base01'] = '#1e1e2e ', - ['base02'] = '#313244', - ['base03'] = '#6c7086', - ['base04'] = '#a6adc8', - ['base05'] = '#cdd6f4', - ['base06'] = '#f5e0dc', - ['base07'] = '#b4befe', - ['base08'] = '#f38ba8', - ['base09'] = '#fab387', - ['base0A'] = '#f9e2af', - ['base0B'] = '#a6e3a1', - ['base0C'] = '#94e2d5', - ['base0D'] = '#89b4fa', - ['base0E'] = '#cba6f7', - ['base0F'] = '#f2cdcd', -} - -lexers.colors = colors - -local fg = ',fore:'..colors.base05..',' -local bg = ',back:'..colors.base01..',' -local cmnt = ',fore:'..colors.base03..',' - -lexers.STYLE_DEFAULT = bg..fg -lexers.STYLE_NOTHING = bg -lexers.STYLE_CLASS = 'fore:'..colors.base0A -lexers.STYLE_COMMENT = cmnt -lexers.STYLE_CONSTANT = fg -lexers.STYLE_DEFINITION = fg -lexers.STYLE_ERROR = 'fore:'..colors.base08 -lexers.STYLE_FUNCTION = fg -lexers.STYLE_KEYWORD = 'fore:'..colors.base0D -lexers.STYLE_LABEL = fg -lexers.STYLE_NUMBER = fg -lexers.STYLE_OPERATOR = fg -lexers.STYLE_REGEX = fg -lexers.STYLE_STRING = 'fore:'..colors.base0B -lexers.STYLE_PREPROCESSOR = fg -lexers.STYLE_TAG = fg -lexers.STYLE_TYPE = fg -lexers.STYLE_VARIABLE = fg -lexers.STYLE_WHITESPACE = fg -lexers.STYLE_EMBEDDED = fg -lexers.STYLE_IDENTIFIER = fg - -lexers.STYLE_LINENUMBER = cmnt -lexers.STYLE_CURSOR = 'reverse' -lexers.STYLE_CURSOR_PRIMARY = bg..fg -lexers.STYLE_CURSOR_LINE = bg -lexers.STYLE_COLOR_COLUMN = bg -lexers.STYLE_SELECTION = 'reverse' -lexers.STYLE_STATUS = cmnt..bg -lexers.STYLE_STATUS_FOCUSED = fg..bg -lexers.STYLE_SEPARATOR = cmnt -lexers.STYLE_EOF = cmnt diff --git a/pkg/vis/config/visrc.lua b/pkg/vis/config/visrc.lua @@ -1,16 +0,0 @@ -require('vis') -require('plugins/commentary') -require('plugins/surround') -require('config/status') -require('config/navigation') -require('config/picker') - -vis.events.subscribe(vis.events.INIT, function() - vis:command('set theme default-16') - vis:command('set autoindent on') -end) - -vis.events.subscribe(vis.events.WIN_OPEN, function(win) - vis:command('set tabwidth 4') - vis:command('set expandtab on') -end) diff --git a/pkg/vis/gen.sh b/pkg/vis/gen.sh @@ -0,0 +1,96 @@ +fetch git + +setv version v0.9 + +cflags " + -std=c99 + -D CONFIG_HELP=1 + -D CONFIG_CURSES=1 + -D CONFIG_LUA=1 + -D CONFIG_LPEG=1 + -D CONFIG_TRE=0 + -D CONFIG_SELINUX=0 + -D CONFIG_ACL=0 + -D HAVE_MEMRCHR=1 + -D LUA_COMPAT_APIINTCASTS + -D _XOPEN_SOURCE=700 + -D VERSION='\"\$version\"' + -D VIS_PATH='"\"'/$PREFIX/share/vis'\""' + -D NDEBUG + -I $outdir/_include + -isystem $builddir/pkg/libtermkey/include + -isystem $builddir/pkg/lua/include + -isystem $builddir/pkg/netbsd-curses/include + -Wno-unused-parameter + -Wno-missing-field-initializers +" + +build copy $outdir/_include/config.h $srcdir/config.def.h + +dep " + $outdir/_include/config.h + libtermkey/headers + lua/headers + netbsd-curses/headers +" + +exe vis " + array.c + buffer.c + libutf.c + main.c + map.c + sam.c + text.c + text-common.c + text-io.c + text-iterator.c + text-motions.c + text-objects.c + text-util.c + ui-terminal.c + view.c + vis.c + vis-lua.c + vis-marks.c + vis-modes.c + vis-motions.c + vis-operators.c + vis-prompt.c + vis-registers.c + vis-text-objects.c + vis-subprocess.c + text-regex.c + $pkgdir/libtermkey/libtermkey.a.d + $pkgdir/lpeg/liblpeg.a + $pkgdir/lua/liblua.a + $pkgdir/netbsd-curses/libcurses.a.d +" + +exe vis-digraph vis-digraph.c +exe vis-menu vis-menu.c +build copy $outdir/vis-open $srcdir/vis-open + +visman() { + build sed $outdir/_man/$1 $srcdir/man/$1 + bind expr 's,VERSION,$version,' + man $outdir/_man/$1 +} + +bin vis +bin vis-digraph +bin vis-menu +bin vis-open + +visman vis.1 +visman vis-digraph.1 +visman vis-menu.1 +visman vis-open.1 + +for f in $(cat $DIR/lua.txt | xargs); do + build copy $outdir/_lua/$f $srcdir/lua/$f + reg $outdir/_lua/$f /share/vis/$f +done + +sym lexers/lexer.lua /share/vis/lexer.lua +sym base-16.lua /share/vis/themes/default.lua diff --git a/pkg/vis/lua.txt b/pkg/vis/lua.txt @@ -0,0 +1,167 @@ +lexers/actionscript.lua +lexers/ada.lua +lexers/ansi_c.lua +lexers/antlr.lua +lexers/apdl.lua +lexers/apl.lua +lexers/applescript.lua +lexers/asm.lua +lexers/asp.lua +lexers/autohotkey.lua +lexers/autoit.lua +lexers/awk.lua +lexers/bash.lua +lexers/batch.lua +lexers/bibtex.lua +lexers/boo.lua +lexers/caml.lua +lexers/chuck.lua +lexers/clojure.lua +lexers/cmake.lua +lexers/coffeescript.lua +lexers/container.lua +lexers/context.lua +lexers/cpp.lua +lexers/crystal.lua +lexers/csharp.lua +lexers/css.lua +lexers/cuda.lua +lexers/dart.lua +lexers/desktop.lua +lexers/diff.lua +lexers/django.lua +lexers/dmd.lua +lexers/dockerfile.lua +lexers/dot.lua +lexers/dsv.lua +lexers/eiffel.lua +lexers/elixir.lua +lexers/elm.lua +lexers/erlang.lua +lexers/fantom.lua +lexers/faust.lua +lexers/fennel.lua +lexers/fish.lua +lexers/forth.lua +lexers/fortran.lua +lexers/fsharp.lua +lexers/fstab.lua +lexers/gap.lua +lexers/gemini.lua +lexers/gettext.lua +lexers/gherkin.lua +lexers/git-rebase.lua +lexers/gleam.lua +lexers/glsl.lua +lexers/gnuplot.lua +lexers/go.lua +lexers/groovy.lua +lexers/gtkrc.lua +lexers/hare.lua +lexers/haskell.lua +lexers/html.lua +lexers/icon.lua +lexers/idl.lua +lexers/inform.lua +lexers/ini.lua +lexers/io_lang.lua +lexers/java.lua +lexers/javascript.lua +lexers/jq.lua +lexers/json.lua +lexers/jsp.lua +lexers/julia.lua +lexers/latex.lua +lexers/ledger.lua +lexers/less.lua +lexers/lexer.lua +lexers/lilypond.lua +lexers/lisp.lua +lexers/litcoffee.lua +lexers/logtalk.lua +lexers/lua.lua +lexers/makefile.lua +lexers/man.lua +lexers/markdown.lua +lexers/matlab.lua +lexers/mediawiki.lua +lexers/meson.lua +lexers/moonscript.lua +lexers/myrddin.lua +lexers/nemerle.lua +lexers/networkd.lua +lexers/nim.lua +lexers/nsis.lua +lexers/null.lua +lexers/objeck.lua +lexers/objective_c.lua +lexers/output.lua +lexers/pascal.lua +lexers/perl.lua +lexers/php.lua +lexers/pico8.lua +lexers/pike.lua +lexers/pkgbuild.lua +lexers/pony.lua +lexers/powershell.lua +lexers/prolog.lua +lexers/props.lua +lexers/protobuf.lua +lexers/ps.lua +lexers/pure.lua +lexers/python.lua +lexers/rails.lua +lexers/rc.lua +lexers/reason.lua +lexers/rebol.lua +lexers/rest.lua +lexers/rexx.lua +lexers/rhtml.lua +lexers/routeros.lua +lexers/rpmspec.lua +lexers/rstats.lua +lexers/ruby.lua +lexers/rust.lua +lexers/sass.lua +lexers/scala.lua +lexers/scheme.lua +lexers/smalltalk.lua +lexers/sml.lua +lexers/snobol4.lua +lexers/spin.lua +lexers/sql.lua +lexers/strace.lua +lexers/systemd.lua +lexers/taskpaper.lua +lexers/tcl.lua +lexers/tex.lua +lexers/texinfo.lua +lexers/text.lua +lexers/toml.lua +lexers/troff.lua +lexers/txt2tags.lua +lexers/typescript.lua +lexers/vala.lua +lexers/vb.lua +lexers/vbscript.lua +lexers/vcard.lua +lexers/verilog.lua +lexers/vhdl.lua +lexers/wsf.lua +lexers/xml.lua +lexers/xs.lua +lexers/xtend.lua +lexers/yaml.lua +lexers/zig.lua +plugins/complete-filename.lua +plugins/complete-word.lua +plugins/digraph.lua +plugins/filetype.lua +plugins/number-inc-dec.lua +plugins/textobject-lexer.lua +themes/base-16.lua +themes/solarized.lua +themes/zenburn.lua +vis-std.lua +vis.lua +visrc.lua diff --git a/pkg/vis/patches/0001-use-system-clipboard-by-default.patch b/pkg/vis/patches/0001-use-system-clipboard-by-default.patch @@ -1,35 +0,0 @@ -From 38a484332b1002a8281c9d10cfd4a3a2a21d5f80 Mon Sep 17 00:00:00 2001 -From: Jul <jul@qh.is> -Date: Fri, 8 Aug 2025 03:29:57 -0400 -Subject: [PATCH 1/2] use system clipboard by default - ---- - vis-operators.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/vis-operators.c b/vis-operators.c -index 123d126..bd9065d 100644 ---- a/vis-operators.c -+++ b/vis-operators.c -@@ -32,8 +32,8 @@ static size_t op_yank(Vis *vis, Text *txt, OperatorContext *c) { - c->reg->linewise = c->linewise; - register_slot_put_range(vis, c->reg, c->reg_slot, txt, &c->range); - if (c->reg == &vis->registers[VIS_REG_DEFAULT]) { -- vis->registers[VIS_REG_ZERO].linewise = c->reg->linewise; -- register_slot_put_range(vis, &vis->registers[VIS_REG_ZERO], c->reg_slot, txt, &c->range); -+ vis->registers[VIS_REG_CLIPBOARD].linewise = c->reg->linewise; -+ register_slot_put_range(vis, &vis->registers[VIS_REG_CLIPBOARD], c->reg_slot, txt, &c->range); - } - return c->linewise ? c->pos : c->range.start; - } -@@ -63,6 +63,7 @@ static size_t op_put(Vis *vis, Text *txt, OperatorContext *c) { - } - - size_t len; -+ c->reg->type = REGISTER_CLIPBOARD; - const char *data = register_slot_get(vis, c->reg, c->reg_slot, &len); - - for (int i = 0; i < c->count; i++) { --- -2.50.1 - diff --git a/pkg/vis/patches/0002-hide-prompt-on-escape-in-insert-mode.patch b/pkg/vis/patches/0002-hide-prompt-on-escape-in-insert-mode.patch @@ -1,24 +0,0 @@ -From d90961d2f360158c5f245dfa393a396ba322f5ac Mon Sep 17 00:00:00 2001 -From: Jul <jul@qh.is> -Date: Fri, 8 Aug 2025 05:27:50 -0400 -Subject: [PATCH 2/2] hide prompt on escape in insert mode - ---- - vis-prompt.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/vis-prompt.c b/vis-prompt.c -index bf1aeb2..92ac258 100644 ---- a/vis-prompt.c -+++ b/vis-prompt.c -@@ -173,6 +173,7 @@ void vis_prompt_show(Vis *vis, const char *title) { - vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<C-j>", &prompt_enter_binding); - vis_window_mode_map(prompt, VIS_MODE_VISUAL, true, "<Enter>", &prompt_enter_binding); - vis_window_mode_map(prompt, VIS_MODE_NORMAL, true, "<Escape>", &prompt_esc_binding); -+ vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Escape>", &prompt_esc_binding); - vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Up>", &prompt_up_binding); - if (CONFIG_LUA) - vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Tab>", &prompt_tab_binding); --- -2.50.1 - diff --git a/tpl/alpine-template/gen.sh b/tpl/alpine-template/gen.sh @@ -1,2 +1,4 @@ template alpine-template pkg rc +pkg vis +pkg netbsd-curses /share/misc/terminfo