Add package: neatvi
This commit is contained in:
37
extra/neatvi.d/Makefile
Normal file
37
extra/neatvi.d/Makefile
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
version=3be48e27c9694d87c8c7ea5a7d7bcc58957daab9
|
||||||
|
|
||||||
|
package=neatvi
|
||||||
|
pkgver=${version}_0
|
||||||
|
description=A small vi/ex editor editing bidirectional UTF-8 text
|
||||||
|
conflict=
|
||||||
|
homepage=https://github.com/aligrudi/neatvi
|
||||||
|
license=
|
||||||
|
provides=
|
||||||
|
replaces=nvi
|
||||||
|
|
||||||
|
alternatives=vi:/usr/bin/vi:neatvi ex:/usr/bin/ex:neatvi
|
||||||
|
shlib-provies=
|
||||||
|
shlib-requires=libc.so
|
||||||
|
|
||||||
|
include ../../Makefile
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES = \
|
||||||
|
${version}.tar.gz
|
||||||
|
|
||||||
|
FILES = \
|
||||||
|
files/conf.h
|
||||||
|
|
||||||
|
${version}.tar.gz:
|
||||||
|
$(DOWNLOAD) https://github.com/aligrudi/neatvi/archive/$@
|
||||||
|
$(SHA256) "7c2e5f17f97217a55f2be1834e20b937a8ddfeea83a598153ce05b005479c43b"
|
||||||
|
|
||||||
|
prepare: ${SOURCES}
|
||||||
|
tar -zxf ${version}.tar.gz
|
||||||
|
mv neatvi-${version} build/
|
||||||
|
mv -f files/conf.h build
|
||||||
|
|
||||||
|
root:
|
||||||
|
${MAKE}
|
||||||
|
install -Dm755 vi "${root}/usr/bin/neatvi"
|
||||||
|
|
||||||
107
extra/neatvi.d/files/conf.h
Normal file
107
extra/neatvi.d/files/conf.h
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
// neatvi configuration file
|
||||||
|
|
||||||
|
#define MKFILE_MODE 0600
|
||||||
|
|
||||||
|
static struct filetype {
|
||||||
|
char *ft; // file type
|
||||||
|
char *pat; // file name pattern
|
||||||
|
} filetypes[] = {
|
||||||
|
{"sh", "\\.sh$"}, // shell script
|
||||||
|
{"c", "\\.(h|c)$"}, // C
|
||||||
|
{"roff", "\\.(t|aux|[1-9]|bib)$|tmac\\."}, // troff
|
||||||
|
{"msg", "(mutt|COMMIT)"}, // email
|
||||||
|
{"mk", "\\.(d|mk)$|[Mm]akefile$"}, // makefile
|
||||||
|
{"diff", "\\.(patch|diff)$"} // diff
|
||||||
|
};
|
||||||
|
|
||||||
|
#define COMMENT 7 | SYN_IT
|
||||||
|
#define STRING 9 | SYN_IT
|
||||||
|
#define KEYWORD 4
|
||||||
|
#define OTHER 3
|
||||||
|
|
||||||
|
static struct highlight {
|
||||||
|
char *ft; // the filetype of this pattern
|
||||||
|
int att[16]; // attributes of the matched groups
|
||||||
|
char *pat; // regular expression
|
||||||
|
int end; // the group ending this pattern
|
||||||
|
} highlights[] = {
|
||||||
|
// c code
|
||||||
|
{"c", {COMMENT}, "//.*$"},
|
||||||
|
{"c", {STRING}, "\"[^\"]*\""},
|
||||||
|
{"c", {KEYWORD}, "\\<(return|for|while|if|else|do|sizeof|goto|switch|case|default|break|continue)\\>"},
|
||||||
|
{"c", {KEYWORD}, "\\<(auto|char|short|int|long|float|double|void|struct|enum|union|typedef)\\>"},
|
||||||
|
{"c", {KEYWORD}, "\\<(signed|volatile|unsigned|static|inline|const|extern|register)\\>"},
|
||||||
|
{"c", {OTHER}, "^#.*$"},
|
||||||
|
{"c", {OTHER}, "[A-Z_]+"},
|
||||||
|
{"c", {OTHER}, "[-+]?\\<(0[xX][0-9a-fA-F]+|0[bB][0-1]+|[0-9]+)\\>"},
|
||||||
|
{"c", {OTHER}, "'\\\\?.'" },
|
||||||
|
|
||||||
|
// roff
|
||||||
|
{"roff", {SYN_BD | KEYWORD}, "^[%.][ \t]*[^ \t$]+" },
|
||||||
|
{"roff", {OTHER}, "\\$[^$]+\\$"},
|
||||||
|
{"roff", {STRING}, "\\\\[\\]?[AbBCDhHlLNRsSvwxXZ]'[^']+'"},
|
||||||
|
{"roff", {OTHER}, "\\\\[\\]?[\\*fFgkmMnsVY]?[+-]?(\\[[^\\]+\\]|\\(..)"},
|
||||||
|
{"roff", {OTHER}, "\\\\[\\]?([a-zA-Z]+|\\$.)"},
|
||||||
|
|
||||||
|
// mail
|
||||||
|
{"msg", {COMMENT}, "#.*$" },
|
||||||
|
{"msg", {SYN_BD}, "^.+:"},
|
||||||
|
{"msg", {OTHER | SYN_IT}, "^> .*$"},
|
||||||
|
|
||||||
|
// makefile
|
||||||
|
{"mk", {COMMENT}, "#.*$"},
|
||||||
|
{"mk", {KEYWORD}, "^[^\t]+[^\t ]*="},
|
||||||
|
{"mk", {SYN_BD}, "^[^\t]+:"},
|
||||||
|
{"mk", {OTHER}, "\\$[\\{\\(][^ \t\\}\\)]+[\\}\\)]"},
|
||||||
|
{"mk", {OTHER}, "\\$."},
|
||||||
|
|
||||||
|
// diff
|
||||||
|
{"diff", {COMMENT}, "^@.*$"},
|
||||||
|
{"diff", {SYN_BD}, "^diff .*$"},
|
||||||
|
{"diff", {1}, "^-.*$"},
|
||||||
|
{"diff", {2}, "^\\+.*$"},
|
||||||
|
|
||||||
|
// sh
|
||||||
|
{"sh", {COMMENT}, "#.*$"},
|
||||||
|
{"sh", {STRING}, "'[^']*'"},
|
||||||
|
{"sh", {STRING}, "\"[^\"]*\""},
|
||||||
|
{"sh", {OTHER}, "\\$[\\{\\(][^\\}\\)]+[\\}\\)]"},
|
||||||
|
{"sh", {OTHER}, "\\$[^ \t$/]+"},
|
||||||
|
{"sh", {KEYWORD}, "\\<(break|case|continue|do|done|elif|else|esac|fi|for|if|in|then|until|while|return)\\>"},
|
||||||
|
{"sh", {SYN_BD}, "^\\. .*$"},
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SYN_LINE (SYN_BGMK(11))
|
||||||
|
#define SYN_REVDIR (SYN_BGMK(7))
|
||||||
|
#define LNPREF ""
|
||||||
|
#define CNEUT "-!\"#$%&'()*+,./:;<=>?@^_`{|}~ "
|
||||||
|
|
||||||
|
// direction context patterns; specifies the direction of a whole line
|
||||||
|
static struct dircontext {
|
||||||
|
int dir;
|
||||||
|
char *pat;
|
||||||
|
} dircontexts[] = {
|
||||||
|
{+1, "^[a-zA-Z_0-9]"},
|
||||||
|
};
|
||||||
|
|
||||||
|
// direction marks; the direction of a few words in a line
|
||||||
|
static struct dirmark {
|
||||||
|
int ctx; // the direction context for this mark; 0 means any
|
||||||
|
int dir; // the direction of the matched text
|
||||||
|
int grp; // the nested subgroup; 0 means no groups
|
||||||
|
char *pat;
|
||||||
|
} dirmarks[] = {
|
||||||
|
{+0, +1, 1, "\\\\\\*\\[([^]]+)\\]"},
|
||||||
|
{+0, +1, 0, "\\$([^$]+)\\$"},
|
||||||
|
{+0, +1, 1, "\\\\[a-zA-Z0-9_]+\\{([^}]+)\\}"},
|
||||||
|
};
|
||||||
|
|
||||||
|
// character placeholders
|
||||||
|
static struct placeholder {
|
||||||
|
char *s; // the source character
|
||||||
|
char *d; // the placeholder
|
||||||
|
int wid; // the width of the placeholder
|
||||||
|
} placeholders[] = {
|
||||||
|
{"", "-", 1},
|
||||||
|
{"", "-", 1},
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user