From d49fd7f88e2587683827640b05f4b37801c6dac9 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 10 Jun 2017 16:49:51 -0400 Subject: Move actual dotfiles into curtis directory --- curtis/.bin/bri.c | 78 +++++ curtis/.bin/clock.c | 33 ++ curtis/.bin/jrp.c | 273 ++++++++++++++++ curtis/.bin/manpager | 1 + curtis/.bin/pbcopy.c | 55 ++++ curtis/.bin/pbd.c | 73 +++++ curtis/.bin/xx.c | 116 +++++++ curtis/.config/git/config | 15 + curtis/.config/git/ignore | 2 + curtis/.config/htop/htoprc | 26 ++ curtis/.config/nvim/autoload/pathogen.vim | 289 ++++++++++++++++ curtis/.config/nvim/colors/trivial.vim | 57 ++++ curtis/.config/nvim/init.vim | 35 ++ curtis/.config/nvim/syntax/nasm.vim | 527 ++++++++++++++++++++++++++++++ curtis/.gdbinit | 1 + curtis/.gnupg/gpg-agent.conf | 2 + curtis/.inputrc | 1 + curtis/.psqlrc | 9 + curtis/.ssh/config | 12 + curtis/.tmux.conf | 45 +++ curtis/.zshrc | 65 ++++ 21 files changed, 1715 insertions(+) create mode 100755 curtis/.bin/bri.c create mode 100755 curtis/.bin/clock.c create mode 100755 curtis/.bin/jrp.c create mode 100755 curtis/.bin/manpager create mode 100755 curtis/.bin/pbcopy.c create mode 100755 curtis/.bin/pbd.c create mode 100755 curtis/.bin/xx.c create mode 100644 curtis/.config/git/config create mode 100644 curtis/.config/git/ignore create mode 100644 curtis/.config/htop/htoprc create mode 100644 curtis/.config/nvim/autoload/pathogen.vim create mode 100644 curtis/.config/nvim/colors/trivial.vim create mode 100644 curtis/.config/nvim/init.vim create mode 100644 curtis/.config/nvim/syntax/nasm.vim create mode 100644 curtis/.gdbinit create mode 100644 curtis/.gnupg/gpg-agent.conf create mode 100644 curtis/.inputrc create mode 100644 curtis/.psqlrc create mode 100644 curtis/.ssh/config create mode 100644 curtis/.tmux.conf create mode 100644 curtis/.zshrc (limited to 'curtis') diff --git a/curtis/.bin/bri.c b/curtis/.bin/bri.c new file mode 100755 index 00000000..4c53475f --- /dev/null +++ b/curtis/.bin/bri.c @@ -0,0 +1,78 @@ +#if 0 +cc -Wall -Wextra -pedantic $@ -o $(dirname $0)/bri $0 && \ +sudo chown root:root $(dirname $0)/bri && \ +sudo chmod u+s $(dirname $0)/bri +exit +#endif + +// Backlight brightness control. + +#include +#include +#include +#include +#include +#include +#include + +static const char *CLASS = "/sys/class/backlight"; + +int main(int argc, char *argv[]) { + int error; + + if (argc < 2) errx(EX_USAGE, "usage: bri N | +... | -..."); + + error = chdir(CLASS); + if (error) err(EX_IOERR, "%s", CLASS); + + DIR *dir = opendir("."); + if (!dir) err(EX_IOERR, "%s", CLASS); + + struct dirent *entry; + while (NULL != (errno = 0, entry = readdir(dir))) { + if (entry->d_name[0] == '.') continue; + + error = chdir(entry->d_name); + if (error) err(EX_IOERR, "%s", entry->d_name); + break; + } + if (!entry) { + if (errno) err(EX_IOERR, "%s", CLASS); + errx(EX_CONFIG, "empty %s", CLASS); + } + + char *value = argv[1]; + + if (value[0] == '+' || value[0] == '-') { + FILE *actual = fopen("actual_brightness", "r"); + if (!actual) err(EX_IOERR, "actual_brightness"); + + unsigned int brightness; + int match = fscanf(actual, "%u", &brightness); + if (match == EOF) err(EX_IOERR, "actual_brightness"); + if (match < 1) err(EX_DATAERR, "actual_brightness"); + + size_t count = strnlen(value, 15); + if (value[0] == '+') { + brightness += 16 * count; + } else { + brightness -= 16 * count; + } + + char buf[15]; + snprintf(buf, sizeof(buf), "%u", brightness); + + value = buf; + } + + error = setuid(0); + if (error) err(EX_NOPERM, "setuid(0)"); + + FILE *brightness = fopen("brightness", "w"); + if (!brightness) err(EX_IOERR, "brightness"); + + int count = fprintf(brightness, "%s", value); + if (count < 0) err(EX_IOERR, "brightness"); + + return EX_OK; +} diff --git a/curtis/.bin/clock.c b/curtis/.bin/clock.c new file mode 100755 index 00000000..288884d8 --- /dev/null +++ b/curtis/.bin/clock.c @@ -0,0 +1,33 @@ +#if 0 +exec cc -Wall -Wextra -pedantic $@ -o $(dirname $0)/clock $0 +#endif + +// Fuzzy clock for display in tmux. + +#include +#include +#include +#include + +int main() { + time_t ts = time(NULL); + if (ts < 0) err(EX_OSERR, "time"); + + struct tm *time = localtime(&ts); + if (!time) err(EX_OSERR, "localtime"); + + int hour = time->tm_hour; + int next = (hour + 1) % 24; + + switch ((time->tm_min + 5) / 10) { + case 0: printf("..%02d..\n", hour); break; + case 1: printf(".%02d...\n", hour); break; + case 2: printf("%02d....\n", hour); break; + case 3: printf("%d....%d\n", hour % 10, next / 10); break; + case 4: printf("....%02d\n", next); break; + case 5: printf("...%02d.\n", next); break; + case 6: printf("..%02d..\n", next); break; + } + + return EX_OK; +} diff --git a/curtis/.bin/jrp.c b/curtis/.bin/jrp.c new file mode 100755 index 00000000..9317ac8e --- /dev/null +++ b/curtis/.bin/jrp.c @@ -0,0 +1,273 @@ +#if 0 +exec cc -Wall -Wextra -pedantic $@ $0 -ledit -o $(dirname $0)/jrp +#endif + +// JIT RPN calculator. + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef unsigned long qop; +typedef unsigned int dop; + +typedef long qvalue; +typedef int dvalue; +typedef unsigned long uvalue; + +typedef qvalue *(*jitFn)(qvalue *); +typedef void (*rtFn)(qvalue); + +static char *formatBin(qvalue val) { + static char buf[sizeof(qvalue) * 8 + 1]; + uvalue uval = val; + size_t i = sizeof(buf); + do { + buf[--i] = '0' + (uval & 1); + } while (uval >>= 1); + return &buf[i]; +} + +static void rtPrintAscii(qvalue val) { + printf("%c\n", (char)val); +} +static void rtPrintBin(qvalue val) { + printf("%s\n", formatBin(val)); +} +static void rtPrintOct(qvalue val) { + printf("%lo\n", val); +} +static void rtPrintDec(qvalue val) { + printf("%ld\n", val); +} +static void rtPrintHex(qvalue val) { + printf("%lx\n", val); +} + +static const dop DOP_NOP = 0x90666666; // nop +static const dop DOP_PUSH = 0xc7c74857; // push rdi; mov rdi, strict dword 0 +static const dop DOP_DROP = 0x9066665f; // pop rdi +static const dop DOP_DUP = 0x90666657; // push rdi +static const dop DOP_SWAP = 0x243c8748; // xchg rdi, [rsp] +static const dop DOP_NEG = 0x90dff748; // neg rdi +static const dop DOP_ADD = 0xc7014858; // pop rax; add rdi, rax +static const dop DOP_QUO = 0x90c78948; // mov rdi, rax +static const dop DOP_REM = 0x90d78948; // mov rdi, rdx +static const dop DOP_NOT = 0x90d7f748; // not rdi +static const dop DOP_AND = 0xc7214858; // pop rax; and rdi, rax +static const dop DOP_OR = 0xc7094858; // pop rax; or rdi, rax +static const dop DOP_XOR = 0xc7314858; // pop rax; xor rdi, rax + +static const qop QOP_PROL = 0x5ffc8948e5894855; // push rbp; mov rbp, rsp; mov rsp, rdi; pop rdi +static const qop QOP_EPIL = 0x5dec8948e0894857; // push rdi; mov rax, rsp; mov rsp, rbp; pop rbp +static const qop QOP_RET = 0x90666666906666c3; // ret +static const qop QOP_CRT = 0xb848906690e58748; // xchg rsp, rbp; mov rax, strict qword 0 +static const qop QOP_CALL = 0x90665fe58748d0ff; // call rax; xchg rsp, rbp; pop rdi +static const qop QOP_PUSH = 0xbf48906690666657; // push rdi; mov rdi, strict qword 0 +static const qop QOP_SUB = 0x9066665f243c2948; // sub [rsp], rdi; pop rdi +static const qop QOP_MUL = 0x906666f8af0f4858; // pop rax; imul rdi, rax +static const qop QOP_DIV = 0x9066fff748994858; // pop rax; cqo; idiv rdi +static const qop QOP_SHL = 0x5f2424d348f98948; // mov rcx, rdi; shl qword [rsp], cl; pop rdi +static const qop QOP_SHR = 0x5f242cd348f98948; // mov rcx, rdi; shr qword [rsp], cl; pop rdi + +static int radix = 10; + +static struct { + qop *base; + qop *ptr; + dop dop; +} code; + +static struct { + qvalue *base; + qvalue *limit; + qvalue *ptr; +} stack; + +static void jitDop(dop op) { + if (code.dop) { + *code.ptr++ = (qop)op << 32 | code.dop; + code.dop = 0; + } else { + code.dop = op; + } +} + +static void jitQop(qop op) { + if (code.dop) jitDop(DOP_NOP); + *code.ptr++ = op; +} + +static void jitPush(qvalue imm) { + if ((dvalue)imm == imm) { + jitQop(DOP_PUSH | (qop)imm << 32); + } else { + jitQop(QOP_PUSH); + jitQop((qop)imm); + } +} + +static void jitCall(rtFn fn) { + jitQop(QOP_CRT); + jitQop((qop)fn); + jitQop(QOP_CALL); +} + +static void jitBegin(void) { + code.ptr = code.base; + jitQop(QOP_PROL); +} + +static void jitEnd(void) { + jitQop(QOP_EPIL); + jitQop(QOP_RET); +} + +static void jitInit(void) { + code.base = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); + if (code.base == MAP_FAILED) err(EX_OSERR, "mmap"); +} + +static void stackInit(void) { + stack.base = mmap(0, 2 * getpagesize(), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); + if (stack.base == MAP_FAILED) err(EX_OSERR, "mmap"); + stack.limit = stack.base + getpagesize() / sizeof(qvalue); + stack.ptr = stack.limit; +} + +static void jitExec(void) { + int error; + error = mprotect(code.base, getpagesize(), PROT_READ | PROT_EXEC); + if (error) err(EX_OSERR, "mprotect"); + stack.ptr = ((jitFn)code.base)(stack.ptr); + if (stack.ptr > stack.limit) stack.ptr = stack.limit; + error = mprotect(code.base, getpagesize(), PROT_READ | PROT_WRITE); + if (error) err(EX_OSERR, "mprotect"); +} + +static void jitSrc(const char *src) { + bool quote = false; + while (*src) { + if (quote) { + jitPush(*src++); + quote = false; + continue; + } + + switch (*src) { + case ' ': break; + case 39: quote = true; break; + case 'B': radix = 2; break; + case 'O': radix = 8; break; + case 'D': radix = 10; break; + case 'X': radix = 16; break; + case ';': jitDop(DOP_DROP); break; + case ':': jitDop(DOP_DUP); break; + case 92: jitDop(DOP_SWAP); break; + case '_': jitDop(DOP_NEG); break; + case '+': jitDop(DOP_ADD); break; + case '-': jitQop(QOP_SUB); break; + case '*': jitQop(QOP_MUL); break; + case '/': jitQop(QOP_DIV); jitDop(DOP_QUO); break; + case '%': jitQop(QOP_DIV); jitDop(DOP_REM); break; + case '~': jitDop(DOP_NOT); break; + case '&': jitDop(DOP_AND); break; + case '|': jitDop(DOP_OR); break; + case '^': jitDop(DOP_XOR); break; + case '<': jitQop(QOP_SHL); break; + case '>': jitQop(QOP_SHR); break; + case ',': jitCall(rtPrintAscii); break; + case '.': switch (radix) { + case 2: jitCall(rtPrintBin); break; + case 8: jitCall(rtPrintOct); break; + case 10: jitCall(rtPrintDec); break; + case 16: jitCall(rtPrintHex); break; + } break; + + default: { + char *rest; + qvalue val = strtol(src, &rest, radix); + if (rest != src) { + src = rest; + jitPush(val); + continue; + } + } + } + + src++; + } +} + +static void jitDump(const char *path, FILE *file) { + size_t nitems = code.ptr - code.base; + size_t written = fwrite(code.base, sizeof(qop), nitems, file); + if (written < nitems) err(EX_IOERR, "%s", path); +} + +static char *prompt(EditLine *el __attribute((unused))) { + static char buf[4096]; + char *bufPtr = buf; + for (qvalue *stackPtr = stack.limit - 1; stackPtr >= stack.ptr; --stackPtr) { + size_t bufLen = sizeof(buf) - (bufPtr - buf) - 2; + switch (radix) { + case 2: bufPtr += snprintf(bufPtr, bufLen, " %s", formatBin(*stackPtr)); break; + case 8: bufPtr += snprintf(bufPtr, bufLen, " %lo", *stackPtr); break; + case 10: bufPtr += snprintf(bufPtr, bufLen, " %ld", *stackPtr); break; + case 16: bufPtr += snprintf(bufPtr, bufLen, " %lx", *stackPtr); break; + } + } + buf[0] = '['; + if (bufPtr == buf) bufPtr++; + *bufPtr++ = ']'; + *bufPtr++ = ' '; + *bufPtr = 0; + return buf; +} + +int main(int argc, char *argv[]) { + FILE *file = NULL; + char *path = getenv("JRP_DUMP"); + if (path) { + file = fopen(path, "w"); + if (!file) err(EX_CANTCREAT, "%s", path); + } + + jitInit(); + stackInit(); + + if (argc > 1) { + jitBegin(); + for (int i = 1; i < argc; ++i) + jitSrc(argv[i]); + jitEnd(); + if (file) jitDump(path, file); + jitExec(); + return EX_OK; + } + + EditLine *el = el_init(argv[0], stdin, stdout, stderr); + el_set(el, EL_PROMPT, prompt); + el_set(el, EL_SIGNAL, true); + + for (;;) { + int count; + const char *line = el_gets(el, &count); + if (count < 0) err(EX_IOERR, "el_gets"); + if (!line) break; + + jitBegin(); + jitSrc(line); + jitEnd(); + if (file) jitDump(path, file); + jitExec(); + } + + el_end(el); + return EX_OK; +} diff --git a/curtis/.bin/manpager b/curtis/.bin/manpager new file mode 100755 index 00000000..f358f5d9 --- /dev/null +++ b/curtis/.bin/manpager @@ -0,0 +1 @@ +exec nvim -c 'set ft=man' - 1< /dev/tty 2< /dev/tty diff --git a/curtis/.bin/pbcopy.c b/curtis/.bin/pbcopy.c new file mode 100755 index 00000000..23403d2d --- /dev/null +++ b/curtis/.bin/pbcopy.c @@ -0,0 +1,55 @@ +#if 0 +cc -Wall -Wextra -pedantic $@ -o $(dirname $0)/pbcopy $0 && \ +exec cc -Wall -Wextra -pedantic -DPBPASTE $@ -o $(dirname $0)/pbpaste $0 +#endif + +// pbcopy and pbpaste implementation which connects to pbd. + +#include +#include +#include +#include +#include +#include +#include + +int main() { + int error; + + int client = socket(PF_INET, SOCK_STREAM, 0); + if (client < 0) err(EX_OSERR, "socket"); + + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_port = htons(7062), + .sin_addr = { .s_addr = htonl(0x7f000001) }, + }; + + error = connect(client, (struct sockaddr *)&addr, sizeof(addr)); + if (error) err(EX_OSERR, "connect"); + +#ifdef PBPASTE + int fdIn = client; + int fdOut = STDOUT_FILENO; + error = shutdown(client, SHUT_WR); + if (error) err(EX_OSERR, "shutdown"); +#else + int fdIn = STDIN_FILENO; + int fdOut = client; +#endif + + char readBuf[4096]; + ssize_t readLen; + while (0 < (readLen = read(fdIn, readBuf, sizeof(readBuf)))) { + char *writeBuf = readBuf; + ssize_t writeLen; + while (0 < (writeLen = write(fdOut, writeBuf, readLen))) { + writeBuf += writeLen; + readLen -= writeLen; + } + if (writeLen < 0) err(EX_IOERR, "write"); + } + if (readLen < 0) err(EX_IOERR, "read"); + + return EX_OK; +} diff --git a/curtis/.bin/pbd.c b/curtis/.bin/pbd.c new file mode 100755 index 00000000..e7b61d12 --- /dev/null +++ b/curtis/.bin/pbd.c @@ -0,0 +1,73 @@ +#if 0 +exec cc -Wall -Wextra -pedantic $@ -o $(dirname $0)/pbd $0 +#endif + +// TCP server which pipes between macOS pbcopy and pbpaste. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void spawn(const char *cmd, int childFd, int parentFd) { + pid_t pid = fork(); + if (pid < 0) err(EX_OSERR, "fork"); + + if (pid) { + int status; + pid_t wait = waitpid(pid, &status, 0); + if (wait < 0) err(EX_OSERR, "waitpid"); + + if (status) { + warnx("child %s status %d", cmd, status); + } + } else { + int fd = dup2(parentFd, childFd); + if (fd < 0) err(EX_OSERR, "dup2"); + + int error = execlp(cmd, cmd); + if (error) err(EX_OSERR, "execlp"); + } +} + +int main() { + int error; + + int server = socket(PF_INET, SOCK_STREAM, 0); + if (server < 0) err(EX_OSERR, "socket"); + + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_port = htons(7062), + .sin_addr = { .s_addr = htonl(0x7f000001) }, + }; + + error = bind(server, (struct sockaddr *)&addr, sizeof(addr)); + if (error) err(EX_OSERR, "bind"); + + error = listen(server, 1); + if (error) err(EX_OSERR, "listen"); + + for (;;) { + int client = accept(server, NULL, NULL); + if (client < 0) err(EX_OSERR, "accept"); + + spawn("pbpaste", STDOUT_FILENO, client); + + uint8_t p; + ssize_t peek = recv(client, &p, 1, MSG_PEEK); + if (peek < 0) err(EX_IOERR, "recv"); + + if (peek) { + spawn("pbcopy", STDIN_FILENO, client); + } + + error = close(client); + if (error) err(EX_IOERR, "close"); + } +} diff --git a/curtis/.bin/xx.c b/curtis/.bin/xx.c new file mode 100755 index 00000000..269c9d55 --- /dev/null +++ b/curtis/.bin/xx.c @@ -0,0 +1,116 @@ +#if 0 +exec cc -Wall -Wextra -pedantic $@ -o $(dirname $0)/xx $0 +#endif + +// Hexdump. + +#include +#include +#include +#include +#include +#include +#include +#include + +static bool allZero(const uint8_t *buf, size_t len) { + for (size_t i = 0; i < len; ++i) + if (buf[i]) return false; + return true; +} + +enum { + FLAG_ASCII = 1, + FLAG_OFFSET = 2, + FLAG_SKIP = 4, + FLAG_UNDUMP = 8, +}; + +void dump(size_t cols, size_t group, uint8_t flags, FILE *file) { + uint8_t buf[cols]; + size_t offset = 0, len = 0; + for (;;) { + offset += len; + len = fread(buf, 1, sizeof(buf), file); + if (!len) break; + + if ((flags & FLAG_SKIP) && len == sizeof(buf)) { + static bool skip; + if (allZero(buf, len)) { + if (!skip) printf("*\n"); + skip = true; + continue; + } + skip = false; + } + + if (flags & FLAG_OFFSET) { + printf("%08zx: ", offset); + } + + for (size_t i = 0; i < len; ++i) { + if (group && i && !(i % group)) printf(" "); + printf("%02x ", buf[i]); + } + + if (flags & FLAG_ASCII) { + for (size_t i = len; i < cols; ++i) { + printf((group && !(i % group)) ? " " : " "); + } + printf(" "); + for (size_t i = 0; i < len; ++i) { + printf("%c", isprint(buf[i]) ? buf[i] : '.'); + } + } + + printf("\n"); + if (len < sizeof(buf)) break; + } +} + +void undump(FILE *file) { + uint8_t byte; + int match; + while (1 == (match = fscanf(file, " %hhx", &byte))) { + printf("%c", byte); + } + if (match == 0) errx(EX_DATAERR, "invalid input"); +} + +int main(int argc, char *argv[]) { + size_t cols = 16; + size_t group = 8; + uint8_t flags = FLAG_ASCII | FLAG_OFFSET; + char *path = NULL; + + int opt; + while (0 < (opt = getopt(argc, argv, "ac:fg:hku"))) { + switch (opt) { + case 'a': flags ^= FLAG_ASCII; break; + case 'f': flags ^= FLAG_OFFSET; break; + case 'k': flags ^= FLAG_SKIP; break; + case 'u': flags ^= FLAG_UNDUMP; break; + case 'c': cols = strtoul(optarg, NULL, 10); break; + case 'g': group = strtoul(optarg, NULL, 10); break; + default: + fprintf(stderr, "usage: xx [-afku] [-c cols] [-g group] [file]\n"); + return (opt == 'h') ? EX_OK : EX_USAGE; + } + } + if (!cols) return EX_USAGE; + if (argc > optind) { + path = argv[optind]; + } + + FILE *file = path ? fopen(path, "r") : stdin; + if (!file) err(EX_NOINPUT, "%s", path); + + if (flags & FLAG_UNDUMP) { + undump(file); + } else { + dump(cols, group, flags, file); + } + + if (ferror(file)) err(EX_IOERR, "%s", path); + return EX_OK; +} diff --git a/curtis/.config/git/config b/curtis/.config/git/config new file mode 100644 index 00000000..c34f0a9b --- /dev/null +++ b/curtis/.config/git/config @@ -0,0 +1,15 @@ +[user] + name = Curtis McEnroe + email = programble@gmail.com + +[commit] + gpgSign = true + +[rebase] + autosquash = true + +[pretty] + log = %Cred%h %Creset%s%C(yellow)%d %Cgreen(%ar) %Cblue<%an> + +[include] + path = ./private diff --git a/curtis/.config/git/ignore b/curtis/.config/git/ignore new file mode 100644 index 00000000..380a01a1 --- /dev/null +++ b/curtis/.config/git/ignore @@ -0,0 +1,2 @@ +*.DS_store +.pult* diff --git a/curtis/.config/htop/htoprc b/curtis/.config/htop/htoprc new file mode 100644 index 00000000..f8c272a3 --- /dev/null +++ b/curtis/.config/htop/htoprc @@ -0,0 +1,26 @@ +# Beware! This file is rewritten by htop when settings are changed in the interface. +# The parser is also very primitive, and not human-friendly. +fields=0 48 17 18 39 2 46 47 49 1 +sort_key=47 +sort_direction=1 +hide_threads=0 +hide_kernel_threads=1 +hide_userland_threads=1 +shadow_other_users=0 +show_thread_names=0 +show_program_path=1 +highlight_base_name=1 +highlight_megabytes=1 +highlight_threads=1 +tree_view=1 +header_margin=0 +detailed_cpu_time=0 +cpu_count_from_zero=0 +update_process_names=0 +account_guest_in_cpu_meter=0 +color_scheme=0 +delay=15 +left_meters=AllCPUs Memory Swap +left_meter_modes=1 1 1 +right_meters=Tasks LoadAverage Uptime +right_meter_modes=2 2 2 diff --git a/curtis/.config/nvim/autoload/pathogen.vim b/curtis/.config/nvim/autoload/pathogen.vim new file mode 100644 index 00000000..dbe07f00 --- /dev/null +++ b/curtis/.config/nvim/autoload/pathogen.vim @@ -0,0 +1,289 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.4 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). Curly braces are expanded with pathogen#expand(): +" "bundle/{}" finds all subdirectories inside "bundle" inside all directories +" in the runtime path. +function! pathogen#infect(...) abort + for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] + if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + call pathogen#surround(path) + elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + elseif path =~# '[{}*]' + call pathogen#interpose(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#interpose(path . '/{}') + endif + endfor + call pathogen#cycle_filetype() + if pathogen#is_disabled($MYVIMRC) + return 'finish' + endif + return '' +endfunction + +" Split a path into a list. +function! pathogen#split(path) abort + if type(a:path) == type([]) | return a:path | endif + if empty(a:path) | return [] | endif + let split = split(a:path,'\\\@]','\\&','') + endif +endfunction + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction + +" Section: Deprecated + +function! s:warn(msg) abort + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Prepend all subdirectories of path to the rtp, and append all 'after' +" directories in those subdirectories. Deprecated. +function! pathogen#runtime_prepend_subdirectories(path) abort + call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') + return pathogen#surround(a:path . pathogen#slash() . '{}') +endfunction + +function! pathogen#incubate(...) abort + let name = a:0 ? a:1 : 'bundle/{}' + call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') + return pathogen#interpose(name) +endfunction + +" Deprecated alias for pathogen#interpose(). +function! pathogen#runtime_append_all_bundles(...) abort + if a:0 + call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') + else + call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') + endif + return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') +endfunction + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/curtis/.config/nvim/colors/trivial.vim b/curtis/.config/nvim/colors/trivial.vim new file mode 100644 index 00000000..55f3ced6 --- /dev/null +++ b/curtis/.config/nvim/colors/trivial.vim @@ -0,0 +1,57 @@ +let &t_Co = 16 +hi clear +if exists('syntax_on') + syntax reset +endif + +let colors_name = 'trivial' + +hi Normal ctermbg=NONE ctermfg=NONE + +hi ColorColumn ctermbg=Black +hi EndOfBuffer ctermfg=DarkGray +hi VertSplit cterm=NONE ctermbg=NONE ctermfg=DarkGray +hi LineNr ctermfg=DarkGray +hi MatchParen ctermbg=DarkGray ctermfg=White +hi ModeMsg ctermfg=DarkGray +hi NonText ctermfg=DarkGray +hi Search ctermbg=Yellow ctermfg=Black +hi StatusLine cterm=NONE ctermbg=Black ctermfg=LightGray +hi StatusLineNC cterm=NONE ctermbg=Black ctermfg=DarkGray +hi Visual cterm=inverse ctermbg=NONE + +hi Comment ctermfg=DarkBlue + +hi Constant ctermfg=NONE +hi String ctermfg=DarkCyan +hi link Character String + +hi Identifier cterm=NONE ctermfg=NONE + +hi Statement ctermfg=LightGray + +hi PreProc ctermfg=DarkGreen +hi Macro ctermfg=DarkYellow +hi link PreCondit Macro + +hi Type ctermfg=NONE +hi StorageClass ctermfg=LightGray +hi link Structure StorageClass +hi link Typedef Structure + +hi Special ctermfg=LightGray +hi SpecialComment ctermfg=LightBlue + +hi Underlined ctermfg=NONE + +hi Error ctermbg=NONE ctermfg=LightRed + +hi Todo ctermbg=NONE ctermfg=LightBlue + +hi SpecialKey ctermfg=DarkGray + +hi link rustModPath Identifier + +hi link rubyDefine Structure +hi link rubyStringDelimiter String +hi link rubySymbol String diff --git a/curtis/.config/nvim/init.vim b/curtis/.config/nvim/init.vim new file mode 100644 index 00000000..0e2683a3 --- /dev/null +++ b/curtis/.config/nvim/init.vim @@ -0,0 +1,35 @@ +set hidden +set shortmess=atI +set wildmode=list:longest +set splitbelow splitright + +set ignorecase smartcase inccommand=nosplit +set tabstop=4 expandtab shiftwidth=4 shiftround smartindent +set undofile + +set title +set scrolloff=1 +set number colorcolumn=80,100 +set list listchars=tab:»·,trail:· + +nmap :nohlsearch +command! W w + +colorscheme trivial + +autocmd BufNewFile,BufRead *.asm,*.mac setfiletype nasm +autocmd FileType sh,zsh,ruby setlocal shiftwidth=2 + +" Tarmak 1 +noremap n j +noremap e k +noremap k n +noremap j e +noremap N J +noremap E K +noremap K N +noremap J E +nmap n j +nmap e k + +execute pathogen#infect() diff --git a/curtis/.config/nvim/syntax/nasm.vim b/curtis/.config/nvim/syntax/nasm.vim new file mode 100644 index 00000000..7eeb9abb --- /dev/null +++ b/curtis/.config/nvim/syntax/nasm.vim @@ -0,0 +1,527 @@ +" Vim syntax file +" Language: NASM - The Netwide Assembler (v0.98) +" Maintainer: Andriy Sokolov +" Original Author: Manuel M.H. Stol +" Former Maintainer: Manuel M.H. Stol +" Last Change: 2012 Feb 7 +" NASM Home: http://www.nasm.us/ + + + +" Setup Syntax: +" Clear old syntax settings +if version < 600 + syn clear +elseif exists("b:current_syntax") + finish +endif +" Assembler syntax is case insensetive +syn case ignore + + + +" Vim search and movement commands on identifers +if version < 600 + " Comments at start of a line inside which to skip search for indentifiers + set comments=:; + " Identifier Keyword characters (defines \k) + set iskeyword=@,48-57,#,$,.,?,@-@,_,~ +else + " Comments at start of a line inside which to skip search for indentifiers + setlocal comments=:; + " Identifier Keyword characters (defines \k) + setlocal iskeyword=@,48-57,#,$,.,?,@-@,_,~ +endif + + + +" Comments: +syn region nasmComment start=";" keepend end="$" contains=@nasmGrpInComments +syn region nasmSpecialComment start=";\*\*\*" keepend end="$" +syn keyword nasmInCommentTodo contained TODO FIXME XXX[XXXXX] +syn cluster nasmGrpInComments contains=nasmInCommentTodo +syn cluster nasmGrpComments contains=@nasmGrpInComments,nasmComment,nasmSpecialComment + + + +" Label Identifiers: +" in NASM: 'Everything is a Label' +" Definition Label = label defined by %[i]define or %[i]assign +" Identifier Label = label defined as first non-keyword on a line or %[i]macro +syn match nasmLabelError "$\=\(\d\+\K\|[#.@]\|\$\$\k\)\k*\>" +syn match nasmLabel "\<\(\h\|[?@]\)\k*\>" +syn match nasmLabel "[\$\~]\(\h\|[?@]\)\k*\>"lc=1 +" Labels starting with one or two '.' are special +syn match nasmLocalLabel "\<\.\(\w\|[#$?@~]\)\k*\>" +syn match nasmLocalLabel "\<\$\.\(\w\|[#$?@~]\)\k*\>"ms=s+1 +if !exists("nasm_no_warn") + syn match nasmLabelWarn "\<\~\=\$\=[_.][_.\~]*\>" +endif +if exists("nasm_loose_syntax") + syn match nasmSpecialLabel "\<\.\.@\k\+\>" + syn match nasmSpecialLabel "\<\$\.\.@\k\+\>"ms=s+1 + if !exists("nasm_no_warn") + syn match nasmLabelWarn "\<\$\=\.\.@\(\d\|[#$\.~]\)\k*\>" + endif + " disallow use of nasm internal label format + syn match nasmLabelError "\<\$\=\.\.@\d\+\.\k*\>" +else + syn match nasmSpecialLabel "\<\.\.@\(\h\|[?@]\)\k*\>" + syn match nasmSpecialLabel "\<\$\.\.@\(\h\|[?@]\)\k*\>"ms=s+1 +endif +" Labels can be dereferenced with '$' to destinguish them from reserved words +syn match nasmLabelError "\<\$\K\k*\s*:" +syn match nasmLabelError "^\s*\$\K\k*\>" +syn match nasmLabelError "\<\~\s*\(\k*\s*:\|\$\=\.\k*\)" + + + +" Constants: +syn match nasmStringError +["'`]+ +syn match nasmString +\("[^"]\{-}"\|'[^']\{-}'\|`[^"]\{-}`\)+ +syn match nasmBinNumber "\<[0-1_]\+b\>" +syn match nasmBinNumber "\<\~[0-1_]\+b\>"lc=1 +syn match nasmOctNumber "\<\(\o\|_\)\+q\>" +syn match nasmOctNumber "\<\~\(\o\|_\)\+q\>"lc=1 +syn match nasmDecNumber "\<\(\d\|_\)\+\>" +syn match nasmDecNumber "\<\~\(\d\|_\)\+\>"lc=1 +syn match nasmHexNumber "\<\(\d\(\x\|_\)*h\|0x\(\x\|_\)\+\|\$\d\(\x\|_\)*\)\>" +syn match nasmHexNumber "\<\~\(\d\(\x\|_\)*h\|0x\(\x\|_\)\+\|\$\d\(\x\|_\)*\)\>"lc=1 +syn match nasmFltNumber "\<\(\d\|_\)\+\.\(\d\|_\)*\(e[+-]\=\d\+\)\=\>" +syn keyword nasmFltNumber Inf Infinity Indefinite NaN SNaN QNaN +syn match nasmNumberError "\<\~\s*\d\+\.\d*\(e[+-]\=\d\+\)\=\>" + + +" Netwide Assembler Storage Directives: +" Storage types +syn keyword nasmTypeError DF EXTRN FWORD RESF TBYTE +syn keyword nasmType FAR NEAR SHORT +syn keyword nasmType BYTE WORD DWORD QWORD DQWORD HWORD DHWORD TWORD +syn keyword nasmType CDECL FASTCALL NONE PASCAL STDCALL +syn keyword nasmStorage DB DW DD DQ DDQ DT +syn keyword nasmStorage RESB RESW RESD RESQ RESDQ REST +syn keyword nasmStorage EXTERN GLOBAL COMMON +" Structured storage types +syn match nasmTypeError "\<\(AT\|I\=\(END\)\=\(STRUCT\=\|UNION\)\|I\=END\)\>" +syn match nasmStructureLabel contained "\<\(AT\|I\=\(END\)\=\(STRUCT\=\|UNION\)\|I\=END\)\>" +" structures cannot be nested (yet) -> use: 'keepend' and 're=' +syn cluster nasmGrpCntnStruc contains=ALLBUT,@nasmGrpInComments,nasmMacroDef,@nasmGrpInMacros,@nasmGrpInPreCondits,nasmStructureDef,@nasmGrpInStrucs +syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="^\s*STRUCT\>"hs=e-5 end="^\s*ENDSTRUCT\>"re=e-9 contains=@nasmGrpCntnStruc +syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="^\s*STRUC\>"hs=e-4 end="^\s*ENDSTRUC\>"re=e-8 contains=@nasmGrpCntnStruc +syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="\" end="\" contains=@nasmGrpCntnStruc,nasmInStructure +" union types are not part of nasm (yet) +"syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="^\s*UNION\>"hs=e-4 end="^\s*ENDUNION\>"re=e-8 contains=@nasmGrpCntnStruc +"syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="\" end="\" contains=@nasmGrpCntnStruc,nasmInStructure +syn match nasmInStructure contained "^\s*AT\>"hs=e-1 +syn cluster nasmGrpInStrucs contains=nasmStructure,nasmInStructure,nasmStructureLabel + + + +" PreProcessor Instructions: +" NAsm PreProcs start with %, but % is not a character +syn match nasmPreProcError "%{\=\(%\=\k\+\|%%\+\k*\|[+-]\=\d\+\)}\=" +if exists("nasm_loose_syntax") + syn cluster nasmGrpNxtCtx contains=nasmStructureLabel,nasmLabel,nasmLocalLabel,nasmSpecialLabel,nasmLabelError,nasmPreProcError +else + syn cluster nasmGrpNxtCtx contains=nasmStructureLabel,nasmLabel,nasmLabelError,nasmPreProcError +endif + +" Multi-line macro +syn cluster nasmGrpCntnMacro contains=ALLBUT,@nasmGrpInComments,nasmStructureDef,@nasmGrpInStrucs,nasmMacroDef,@nasmGrpPreCondits,nasmMemReference,nasmInMacPreCondit,nasmInMacStrucDef +syn region nasmMacroDef matchgroup=nasmMacro keepend start="^\s*%macro\>"hs=e-5 start="^\s*%imacro\>"hs=e-6 end="^\s*%endmacro\>"re=e-9 contains=@nasmGrpCntnMacro,nasmInMacStrucDef +if exists("nasm_loose_syntax") + syn match nasmInMacLabel contained "%\(%\k\+\>\|{%\k\+}\)" + syn match nasmInMacLabel contained "%\($\+\(\w\|[#\.?@~]\)\k*\>\|{$\+\(\w\|[#\.?@~]\)\k*}\)" + syn match nasmInMacPreProc contained "^\s*%\(push\|repl\)\>"hs=e-4 skipwhite nextgroup=nasmStructureLabel,nasmLabel,nasmInMacParam,nasmLocalLabel,nasmSpecialLabel,nasmLabelError,nasmPreProcError + if !exists("nasm_no_warn") + syn match nasmInMacLblWarn contained "%\(%[$\.]\k*\>\|{%[$\.]\k*}\)" + syn match nasmInMacLblWarn contained "%\($\+\(\d\|[#\.@~]\)\k*\|{\$\+\(\d\|[#\.@~]\)\k*}\)" + hi link nasmInMacCatLabel nasmInMacLblWarn + else + hi link nasmInMacCatLabel nasmInMacLabel + endif +else + syn match nasmInMacLabel contained "%\(%\(\w\|[#?@~]\)\k*\>\|{%\(\w\|[#?@~]\)\k*}\)" + syn match nasmInMacLabel contained "%\($\+\(\h\|[?@]\)\k*\>\|{$\+\(\h\|[?@]\)\k*}\)" + hi link nasmInMacCatLabel nasmLabelError +endif +syn match nasmInMacCatLabel contained "\d\K\k*"lc=1 +syn match nasmInMacLabel contained "\d}\k\+"lc=2 +if !exists("nasm_no_warn") + syn match nasmInMacLblWarn contained "%\(\($\+\|%\)[_~][._~]*\>\|{\($\+\|%\)[_~][._~]*}\)" +endif +syn match nasmInMacPreProc contained "^\s*%pop\>"hs=e-3 +syn match nasmInMacPreProc contained "^\s*%\(push\|repl\)\>"hs=e-4 skipwhite nextgroup=@nasmGrpNxtCtx +" structures cannot be nested (yet) -> use: 'keepend' and 're=' +syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="^\s*STRUCT\>"hs=e-5 end="^\s*ENDSTRUCT\>"re=e-9 contains=@nasmGrpCntnMacro +syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="^\s*STRUC\>"hs=e-4 end="^\s*ENDSTRUC\>"re=e-8 contains=@nasmGrpCntnMacro +syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="\" end="\" contains=@nasmGrpCntnMacro,nasmInStructure +" union types are not part of nasm (yet) +"syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="^\s*UNION\>"hs=e-4 end="^\s*ENDUNION\>"re=e-8 contains=@nasmGrpCntnMacro +"syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="\" end="\" contains=@nasmGrpCntnMacro,nasmInStructure +syn region nasmInMacPreConDef contained transparent matchgroup=nasmInMacPreCondit start="^\s*%ifnidni\>"hs=e-7 start="^\s*%if\(idni\|n\(ctx\|def\|idn\|num\|str\)\)\>"hs=e-6 start="^\s*%if\(ctx\|def\|idn\|nid\|num\|str\)\>"hs=e-5 start="^\s*%ifid\>"hs=e-4 start="^\s*%if\>"hs=e-2 end="%endif\>" contains=@nasmGrpCntnMacro,nasmInMacPreCondit,nasmInPreCondit +" Todo: allow STRUC/ISTRUC to be used inside preprocessor conditional block +syn match nasmInMacPreCondit contained transparent "ctx\s"lc=3 skipwhite nextgroup=@nasmGrpNxtCtx +syn match nasmInMacPreCondit contained "^\s*%elifctx\>"hs=e-7 skipwhite nextgroup=@nasmGrpNxtCtx +syn match nasmInMacPreCondit contained "^\s*%elifnctx\>"hs=e-8 skipwhite nextgroup=@nasmGrpNxtCtx +syn match nasmInMacParamNum contained "\<\d\+\.list\>"me=e-5 +syn match nasmInMacParamNum contained "\<\d\+\.nolist\>"me=e-7 +syn match nasmInMacDirective contained "\.\(no\)\=list\>" +syn match nasmInMacMacro contained transparent "macro\s"lc=5 skipwhite nextgroup=nasmStructureLabel +syn match nasmInMacMacro contained "^\s*%rotate\>"hs=e-6 +syn match nasmInMacParam contained "%\([+-]\=\d\+\|{[+-]\=\d\+}\)" +" nasm conditional macro operands/arguments +" Todo: check feasebility; add too nasmGrpInMacros, etc. +"syn match nasmInMacCond contained "\<\(N\=\([ABGL]E\=\|[CEOSZ]\)\|P[EO]\=\)\>" +syn cluster nasmGrpInMacros contains=nasmMacro,nasmInMacMacro,nasmInMacParam,nasmInMacParamNum,nasmInMacDirective,nasmInMacLabel,nasmInMacLblWarn,nasmInMacMemRef,nasmInMacPreConDef,nasmInMacPreCondit,nasmInMacPreProc,nasmInMacStrucDef + +" Context pre-procs that are better used inside a macro +if exists("nasm_ctx_outside_macro") + syn region nasmPreConditDef transparent matchgroup=nasmCtxPreCondit start="^\s*%ifnctx\>"hs=e-6 start="^\s*%ifctx\>"hs=e-5 end="%endif\>" contains=@nasmGrpCntnPreCon + syn match nasmCtxPreProc "^\s*%pop\>"hs=e-3 + if exists("nasm_loose_syntax") + syn match nasmCtxLocLabel "%$\+\(\w\|[#.?@~]\)\k*\>" + else + syn match nasmCtxLocLabel "%$\+\(\h\|[?@]\)\k*\>" + endif + syn match nasmCtxPreProc "^\s*%\(push\|repl\)\>"hs=e-4 skipwhite nextgroup=@nasmGrpNxtCtx + syn match nasmCtxPreCondit contained transparent "ctx\s"lc=3 skipwhite nextgroup=@nasmGrpNxtCtx + syn match nasmCtxPreCondit contained "^\s*%elifctx\>"hs=e-7 skipwhite nextgroup=@nasmGrpNxtCtx + syn match nasmCtxPreCondit contained "^\s*%elifnctx\>"hs=e-8 skipwhite nextgroup=@nasmGrpNxtCtx + if exists("nasm_no_warn") + hi link nasmCtxPreCondit nasmPreCondit + hi link nasmCtxPreProc nasmPreProc + hi link nasmCtxLocLabel nasmLocalLabel + else + hi link nasmCtxPreCondit nasmPreProcWarn + hi link nasmCtxPreProc nasmPreProcWarn + hi link nasmCtxLocLabel nasmLabelWarn + endif +endif + +" Conditional assembly +syn cluster nasmGrpCntnPreCon contains=ALLBUT,@nasmGrpInComments,@nasmGrpInMacros,@nasmGrpInStrucs +syn region nasmPreConditDef transparent matchgroup=nasmPreCondit start="^\s*%ifnidni\>"hs=e-7 start="^\s*%if\(idni\|n\(def\|idn\|num\|str\)\)\>"hs=e-6 start="^\s*%if\(def\|idn\|nid\|num\|str\)\>"hs=e-5 start="^\s*%ifid\>"hs=e-4 start="^\s*%if\>"hs=e-2 end="%endif\>" contains=@nasmGrpCntnPreCon +syn match nasmInPreCondit contained "^\s*%el\(if\|se\)\>"hs=e-4 +syn match nasmInPreCondit contained "^\s*%elifid\>"hs=e-6 +syn match nasmInPreCondit contained "^\s*%elif\(def\|idn\|nid\|num\|str\)\>"hs=e-7 +syn match nasmInPreCondit contained "^\s*%elif\(n\(def\|idn\|num\|str\)\|idni\)\>"hs=e-8 +syn match nasmInPreCondit contained "^\s*%elifnidni\>"hs=e-9 +syn cluster nasmGrpInPreCondits contains=nasmPreCondit,nasmInPreCondit,nasmCtxPreCondit +syn cluster nasmGrpPreCondits contains=nasmPreConditDef,@nasmGrpInPreCondits,nasmCtxPreProc,nasmCtxLocLabel + +" Other pre-processor statements +syn match nasmPreProc "^\s*%\(rep\|use\)\>"hs=e-3 +syn match nasmPreProc "^\s*%line\>"hs=e-4 +syn match nasmPreProc "^\s*%\(clear\|error\|fatal\)\>"hs=e-5 +syn match nasmPreProc "^\s*%\(endrep\|strlen\|substr\)\>"hs=e-6 +syn match nasmPreProc "^\s*%\(exitrep\|warning\)\>"hs=e-7 +syn match nasmDefine "^\s*%undef\>"hs=e-5 +syn match nasmDefine "^\s*%\(assign\|define\)\>"hs=e-6 +syn match nasmDefine "^\s*%i\(assign\|define\)\>"hs=e-7 +syn match nasmDefine "^\s*%unmacro\>"hs=e-7 +syn match nasmInclude "^\s*%include\>"hs=e-7 +" Todo: Treat the line tail after %fatal, %error, %warning as text + +" Multiple pre-processor instructions on single line detection (obsolete) +"syn match nasmPreProcError +^\s*\([^\t "%';][^"%';]*\|[^\t "';][^"%';]\+\)%\a\+\>+ +syn cluster nasmGrpPreProcs contains=nasmMacroDef,@nasmGrpInMacros,@nasmGrpPreCondits,nasmPreProc,nasmDefine,nasmInclude,nasmPreProcWarn,nasmPreProcError + + + +" Register Identifiers: +" Register operands: +syn match nasmGen08Register "\<[A-D][HL]\>" +syn match nasmGen16Register "\<\([A-D]X\|[DS]I\|[BS]P\)\>" +syn match nasmGen32Register "\" +syn match nasmGen64Register "\" +syn match nasmSegRegister "\<[C-GS]S\>" +syn match nasmSpcRegister "\" +syn match nasmFpuRegister "\" +syn match nasmMmxRegister "\" +syn match nasmSseRegister "\" +syn match nasmCtrlRegister "\" +syn match nasmDebugRegister "\" +syn match nasmTestRegister "\" +syn match nasmRegisterError "\<\(CR[15-9]\|DR[4-58-9]\|TR[0-28-9]\)\>" +syn match nasmRegisterError "\" +syn match nasmRegisterError "\\)" +syn match nasmRegisterError "\" +" Memory reference operand (address): +syn match nasmMemRefError "[[\]]" +syn cluster nasmGrpCntnMemRef contains=ALLBUT,@nasmGrpComments,@nasmGrpPreProcs,@nasmGrpInStrucs,nasmMemReference,nasmMemRefError +syn match nasmInMacMemRef contained "\[[^;[\]]\{-}\]" contains=@nasmGrpCntnMemRef,nasmPreProcError,nasmInMacLabel,nasmInMacLblWarn,nasmInMacParam +syn match nasmMemReference "\[[^;[\]]\{-}\]" contains=@nasmGrpCntnMemRef,nasmPreProcError,nasmCtxLocLabel + + + +" Netwide Assembler Directives: +" Compilation constants +syn keyword nasmConstant __BITS__ __DATE__ __FILE__ __FORMAT__ __LINE__ +syn keyword nasmConstant __NASM_MAJOR__ __NASM_MINOR__ __NASM_VERSION__ +syn keyword nasmConstant __TIME__ +" Instruction modifiers +syn match nasmInstructnError "\" +syn match nasmInstrModifier "\(^\|:\)\s*[C-GS]S\>"ms=e-1 +syn keyword nasmInstrModifier A16 A32 O16 O32 +syn match nasmInstrModifier "\"lc=5,ms=e-1 +" the 'to' keyword is not allowed for fpu-pop instructions (yet) +"syn match nasmInstrModifier "\"lc=6,ms=e-1 +" NAsm directives +syn keyword nasmRepeat TIMES +syn keyword nasmDirective ALIGN[B] INCBIN EQU NOSPLIT SPLIT +syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT +syn keyword nasmDirective ENDSECTION ENDSEGMENT +syn keyword nasmDirective __SECT__ +" Macro created standard directives: (requires %include) +syn case match +syn keyword nasmStdDirective ENDPROC EPILOGUE LOCALS PROC PROLOGUE USES +syn keyword nasmStdDirective ENDIF ELSE ELIF ELSIF IF +"syn keyword nasmStdDirective BREAK CASE DEFAULT ENDSWITCH SWITCH +"syn keyword nasmStdDirective CASE OF ENDCASE +syn keyword nasmStdDirective DO ENDFOR ENDWHILE FOR REPEAT UNTIL WHILE EXIT +syn case ignore +" Format specific directives: (all formats) +" (excluded: extension directives to section, global, common and extern) +syn keyword nasmFmtDirective ORG +syn keyword nasmFmtDirective EXPORT IMPORT GROUP UPPERCASE SEG WRT +syn keyword nasmFmtDirective LIBRARY +syn case match +syn keyword nasmFmtDirective _GLOBAL_OFFSET_TABLE_ __GLOBAL_OFFSET_TABLE_ +syn keyword nasmFmtDirective ..start ..got ..gotoff ..gotpc ..plt ..sym +syn case ignore + + + +" Standard Instructions: +syn match nasmInstructnError "\<\(F\=CMOV\|SET\)N\=\a\{0,2}\>" +syn keyword nasmInstructnError CMPS MOVS LCS LODS STOS XLAT +syn match nasmStdInstruction "\" +syn match nasmInstructnError "\\s*[^:]"he=e-1 +syn match nasmStdInstruction "\<\(CMOV\|J\|SET\)\(N\=\([ABGL]E\=\|[CEOSZ]\)\|P[EO]\=\)\>" +syn match nasmStdInstruction "\" +syn keyword nasmStdInstruction AAA AAD AAM AAS ADC ADD AND +syn keyword nasmStdInstruction BOUND BSF BSR BSWAP BT[C] BTR BTS +syn keyword nasmStdInstruction CALL CBW CDQ CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ +syn keyword nasmStdInstruction CMPXCHG CMPXCHG8B CPUID CWD[E] CQO +syn keyword nasmStdInstruction DAA DAS DEC DIV ENTER +syn keyword nasmStdInstruction IDIV IMUL INC INT[O] IRET[D] IRETW IRETQ +syn keyword nasmStdInstruction JCXZ JECXZ JMP +syn keyword nasmStdInstruction LAHF LDS LEA LEAVE LES LFS LGS LODSB LODSD LODSQ +syn keyword nasmStdInstruction LODSW LOOP[E] LOOPNE LOOPNZ LOOPZ LSS +syn keyword nasmStdInstruction MOVSB MOVSD MOVSW MOVSX MOVSQ MOVZX MUL NEG NOP NOT +syn keyword nasmStdInstruction OR POPA[D] POPAW POPF[D] POPFW POPFQ +syn keyword nasmStdInstruction PUSH[AD] PUSHAW PUSHF[D] PUSHFW PUSHFQ +syn keyword nasmStdInstruction RCL RCR RETF RET[N] ROL ROR +syn keyword nasmStdInstruction SAHF SAL SAR SBB SCASB SCASD SCASW +syn keyword nasmStdInstruction SHL[D] SHR[D] STC STD STOSB STOSD STOSW STOSQ SUB +syn keyword nasmStdInstruction TEST XADD XCHG XLATB XOR +syn keyword nasmStdInstruction LFENCE MFENCE SFENCE + + +" System Instructions: (usually privileged) +" Verification of pointer parameters +syn keyword nasmSysInstruction ARPL LAR LSL VERR VERW +" Addressing descriptor tables +syn keyword nasmSysInstruction LLDT SLDT LGDT SGDT +" Multitasking +syn keyword nasmSysInstruction LTR STR +" Coprocessing and Multiprocessing (requires fpu and multiple cpu's resp.) +syn keyword nasmSysInstruction CLTS LOCK WAIT +" Input and Output +syn keyword nasmInstructnError INS OUTS +syn keyword nasmSysInstruction IN INSB INSW INSD OUT OUTSB OUTSB OUTSW OUTSD +" Interrupt control +syn keyword nasmSysInstruction CLI STI LIDT SIDT +" System control +syn match nasmSysInstruction "\"me=s+3 +syn keyword nasmSysInstruction HLT INVD LMSW +syn keyword nasmSseInstruction PREFETCHT0 PREFETCHT1 PREFETCHT2 PREFETCHNTA +syn keyword nasmSseInstruction RSM SFENCE SMSW SYSENTER SYSEXIT UD2 WBINVD +" TLB (Translation Lookahead Buffer) testing +syn match nasmSysInstruction "\"me=s+3 +syn keyword nasmSysInstruction INVLPG + +" Debugging Instructions: (privileged) +syn match nasmDbgInstruction "\"me=s+3 +syn keyword nasmDbgInstruction INT1 INT3 RDMSR RDTSC RDPMC WRMSR + + +" Floating Point Instructions: (requires FPU) +syn match nasmFpuInstruction "\" +syn keyword nasmFpuInstruction F2XM1 FABS FADD[P] FBLD FBSTP +syn keyword nasmFpuInstruction FCHS FCLEX FCOM[IP] FCOMP[P] FCOS +syn keyword nasmFpuInstruction FDECSTP FDISI FDIV[P] FDIVR[P] FENI FFREE +syn keyword nasmFpuInstruction FIADD FICOM[P] FIDIV[R] FILD +syn keyword nasmFpuInstruction FIMUL FINCSTP FINIT FIST[P] FISUB[R] +syn keyword nasmFpuInstruction FLD[1] FLDCW FLDENV FLDL2E FLDL2T FLDLG2 +syn keyword nasmFpuInstruction FLDLN2 FLDPI FLDZ FMUL[P] +syn keyword nasmFpuInstruction FNCLEX FNDISI FNENI FNINIT FNOP FNSAVE +syn keyword nasmFpuInstruction FNSTCW FNSTENV FNSTSW FNSTSW +syn keyword nasmFpuInstruction FPATAN FPREM[1] FPTAN FRNDINT FRSTOR +syn keyword nasmFpuInstruction FSAVE FSCALE FSETPM FSIN FSINCOS FSQRT +syn keyword nasmFpuInstruction FSTCW FSTENV FST[P] FSTSW FSUB[P] FSUBR[P] +syn keyword nasmFpuInstruction FTST FUCOM[IP] FUCOMP[P] +syn keyword nasmFpuInstruction FXAM FXCH FXTRACT FYL2X FYL2XP1 + + +" Multi Media Xtension Packed Instructions: (requires MMX unit) +" Standard MMX instructions: (requires MMX1 unit) +syn match nasmInstructnError "\" +syn match nasmInstructnError "\" +syn keyword nasmMmxInstruction EMMS MOVD MOVQ +syn keyword nasmMmxInstruction PACKSSDW PACKSSWB PACKUSWB PADDB PADDD PADDW +syn keyword nasmMmxInstruction PADDSB PADDSW PADDUSB PADDUSW PAND[N] +syn keyword nasmMmxInstruction PCMPEQB PCMPEQD PCMPEQW PCMPGTB PCMPGTD PCMPGTW +syn keyword nasmMmxInstruction PMACHRIW PMADDWD PMULHW PMULLW POR +syn keyword nasmMmxInstruction PSLLD PSLLQ PSLLW PSRAD PSRAW PSRLD PSRLQ PSRLW +syn keyword nasmMmxInstruction PSUBB PSUBD PSUBW PSUBSB PSUBSW PSUBUSB PSUBUSW +syn keyword nasmMmxInstruction PUNPCKHBW PUNPCKHDQ PUNPCKHWD +syn keyword nasmMmxInstruction PUNPCKLBW PUNPCKLDQ PUNPCKLWD PXOR +" Extended MMX instructions: (requires MMX2/SSE unit) +syn keyword nasmMmxInstruction MASKMOVQ MOVNTQ +syn keyword nasmMmxInstruction PAVGB PAVGW PEXTRW PINSRW PMAXSW PMAXUB +syn keyword nasmMmxInstruction PMINSW PMINUB PMOVMSKB PMULHUW PSADBW PSHUFW + + +" Streaming SIMD Extension Packed Instructions: (requires SSE unit) +syn match nasmInstructnError "\" +syn match nasmSseInstruction "\" +syn keyword nasmSseInstruction ADDPS ADDSS ANDNPS ANDPS +syn keyword nasmSseInstruction COMISS CVTPI2PS CVTPS2PI +syn keyword nasmSseInstruction CVTSI2SS CVTSS2SI CVTTPS2PI CVTTSS2SI +syn keyword nasmSseInstruction DIVPS DIVSS FXRSTOR FXSAVE LDMXCSR +syn keyword nasmSseInstruction MAXPS MAXSS MINPS MINSS MOVAPS MOVHLPS MOVHPS +syn keyword nasmSseInstruction MOVLHPS MOVLPS MOVMSKPS MOVNTPS MOVSS MOVUPS +syn keyword nasmSseInstruction MULPS MULSS +syn keyword nasmSseInstruction ORPS RCPPS RCPSS RSQRTPS RSQRTSS +syn keyword nasmSseInstruction SHUFPS SQRTPS SQRTSS STMXCSR SUBPS SUBSS +syn keyword nasmSseInstruction UCOMISS UNPCKHPS UNPCKLPS XORPS + + +" Three Dimensional Now Packed Instructions: (requires 3DNow! unit) +syn keyword nasmNowInstruction FEMMS PAVGUSB PF2ID PFACC PFADD PFCMPEQ PFCMPGE +syn keyword nasmNowInstruction PFCMPGT PFMAX PFMIN PFMUL PFRCP PFRCPIT1 +syn keyword nasmNowInstruction PFRCPIT2 PFRSQIT1 PFRSQRT PFSUB[R] PI2FD +syn keyword nasmNowInstruction PMULHRWA PREFETCH[W] + + +" Vendor Specific Instructions: +" Cyrix instructions (requires Cyrix processor) +syn keyword nasmCrxInstruction PADDSIW PAVEB PDISTIB PMAGW PMULHRW[C] PMULHRIW +syn keyword nasmCrxInstruction PMVGEZB PMVLZB PMVNZB PMVZB PSUBSIW +syn keyword nasmCrxInstruction RDSHR RSDC RSLDT SMINT SMINTOLD SVDC SVLDT SVTS +syn keyword nasmCrxInstruction WRSHR +" AMD instructions (requires AMD processor) +syn keyword nasmAmdInstruction SYSCALL SYSRET + + +" Undocumented Instructions: +syn match nasmUndInstruction "\"me=s+3 +syn keyword nasmUndInstruction CMPXCHG486 IBTS ICEBP INT01 INT03 LOADALL +syn keyword nasmUndInstruction LOADALL286 LOADALL386 SALC SMI UD1 UMOV XBTS + + + +" Synchronize Syntax: +syn sync clear +syn sync minlines=50 "for multiple region nesting +syn sync match nasmSync grouphere nasmMacroDef "^\s*%i\=macro\>"me=s-1 +syn sync match nasmSync grouphere NONE "^\s*%endmacro\>" + + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later : only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_nasm_syntax_inits") + if version < 508 + let did_nasm_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + " Sub Links: + HiLink nasmInMacDirective nasmDirective + HiLink nasmInMacLabel nasmLocalLabel + HiLink nasmInMacLblWarn nasmLabelWarn + HiLink nasmInMacMacro nasmMacro + HiLink nasmInMacParam nasmMacro + HiLink nasmInMacParamNum nasmDecNumber + HiLink nasmInMacPreCondit nasmPreCondit + HiLink nasmInMacPreProc nasmPreProc + HiLink nasmInPreCondit nasmPreCondit + HiLink nasmInStructure nasmStructure + HiLink nasmStructureLabel nasmStructure + + " Comment Group: + HiLink nasmComment Comment + HiLink nasmSpecialComment SpecialComment + HiLink nasmInCommentTodo Todo + + " Constant Group: + HiLink nasmString String + HiLink nasmStringError Error + HiLink nasmBinNumber Number + HiLink nasmOctNumber Number + HiLink nasmDecNumber Number + HiLink nasmHexNumber Number + HiLink nasmFltNumber Float + HiLink nasmNumberError Error + + " Identifier Group: + HiLink nasmLabel Identifier + HiLink nasmLocalLabel Identifier + HiLink nasmSpecialLabel Special + HiLink nasmLabelError Error + HiLink nasmLabelWarn Todo + + " PreProc Group: + HiLink nasmPreProc PreProc + HiLink nasmDefine Define + HiLink nasmInclude Include + HiLink nasmMacro Macro + HiLink nasmPreCondit PreCondit + HiLink nasmPreProcError Error + HiLink nasmPreProcWarn Todo + + " Type Group: + HiLink nasmType Type + HiLink nasmStorage StorageClass + HiLink nasmStructure Structure + HiLink nasmTypeError Error + + " Directive Group: + HiLink nasmConstant Constant + HiLink nasmInstrModifier Operator + HiLink nasmRepeat Repeat + HiLink nasmDirective Keyword + HiLink nasmStdDirective Operator + HiLink nasmFmtDirective Keyword + + " Register Group: + HiLink nasmCtrlRegister Special + HiLink nasmDebugRegister Debug + HiLink nasmTestRegister Special + HiLink nasmRegisterError Error + HiLink nasmMemRefError Error + + " Instruction Group: + HiLink nasmStdInstruction Statement + HiLink nasmSysInstruction Statement + HiLink nasmDbgInstruction Debug + HiLink nasmFpuInstruction Statement + HiLink nasmMmxInstruction Statement + HiLink nasmSseInstruction Statement + HiLink nasmNowInstruction Statement + HiLink nasmAmdInstruction Special + HiLink nasmCrxInstruction Special + HiLink nasmUndInstruction Todo + HiLink nasmInstructnError Error + + delcommand HiLink +endif + +let b:current_syntax = "nasm" + +" vim:ts=8 sw=4 diff --git a/curtis/.gdbinit b/curtis/.gdbinit new file mode 100644 index 00000000..9422460c --- /dev/null +++ b/curtis/.gdbinit @@ -0,0 +1 @@ +set disassembly-flavor intel diff --git a/curtis/.gnupg/gpg-agent.conf b/curtis/.gnupg/gpg-agent.conf new file mode 100644 index 00000000..83ef4996 --- /dev/null +++ b/curtis/.gnupg/gpg-agent.conf @@ -0,0 +1,2 @@ +use-standard-socket +default-cache-ttl 1800 diff --git a/curtis/.inputrc b/curtis/.inputrc new file mode 100644 index 00000000..b2cc9d61 --- /dev/null +++ b/curtis/.inputrc @@ -0,0 +1 @@ +set editing-mode vi diff --git a/curtis/.psqlrc b/curtis/.psqlrc new file mode 100644 index 00000000..60f39755 --- /dev/null +++ b/curtis/.psqlrc @@ -0,0 +1,9 @@ +\set QUIET +\set ON_ERROR_ROLLBACK interactive +\timing on +\setenv PAGER more +\pset expanded auto +\pset null ¤ +\pset linestyle unicode +\pset border 1 +\unset QUIET diff --git a/curtis/.ssh/config b/curtis/.ssh/config new file mode 100644 index 00000000..4068ff35 --- /dev/null +++ b/curtis/.ssh/config @@ -0,0 +1,12 @@ +IgnoreUnknown Include +Include config_private + +HashKnownHosts yes + +Host tux.local thursday.local + ForwardAgent yes + RemoteForward 7062 127.0.0.1:7062 + +Host april + HostName %h.nyc3.do.cmcenroe.me + Port 2222 diff --git a/curtis/.tmux.conf b/curtis/.tmux.conf new file mode 100644 index 00000000..46e9130a --- /dev/null +++ b/curtis/.tmux.conf @@ -0,0 +1,45 @@ +set -g base-index 1 +set -g renumber-windows on +set -g default-terminal 'screen-256color' +set -g terminal-overrides "linux:cnorm=\e[?25h\e[?8c" # cvvis +set -g escape-time 0 + +unbind C-b +set -g prefix C-space +bind space send-prefix + +bind t new-window -c '#{pane_current_path}' +bind s split-window -v -c '#{pane_current_path}' +bind v split-window -h -c '#{pane_current_path}' + +bind C-space last-window +bind C-w last-pane +bind h previous-window +bind l next-window + +bind L swap-pane -D +bind H swap-pane -U + +bind = select-layout even-horizontal +bind -r < resize-pane -L 1 +bind -r > resize-pane -R 1 +bind -r - resize-pane -U 1 +bind -r + resize-pane -D 1 + +bind p paste-buffer +bind Escape copy-mode +bind -T copy-mode-vi i send -X cancel +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi C-v send -X rectangle-toggle +bind -T copy-mode-vi y send -X copy-selection + +set -g status-position top +set -g status-style bg=black,fg=white +set -g window-status-separator '|' +set -g window-status-format ' #{=20:pane_title} ' +set -g window-status-current-format '#[reverse] #{pane_title} ' +set -g status-left '|' +set -g status-right '[#h:#S] #(clock)' + +bind -r F6 run-shell 'bri -' +bind -r F7 run-shell 'bri +' diff --git a/curtis/.zshrc b/curtis/.zshrc new file mode 100644 index 00000000..6b7feebb --- /dev/null +++ b/curtis/.zshrc @@ -0,0 +1,65 @@ +unsetopt beep +setopt nomatch interactive_comments +setopt inc_append_history hist_ignore_dups +HISTFILE=~/.history HISTSIZE=5000 SAVEHIST=5000 + +autoload -Uz compinit && compinit +autoload -Uz colors && colors + +bindkey -v +KEYTIMEOUT=1 + +OLDPATH=$PATH +path=( + /sbin /bin + /usr/local/sbin /usr/local/bin + /usr/sbin /usr/bin + ~/.bin ~/.cargo/bin +) + +export PAGER=less MANPAGER=less EDITOR=vim GIT_EDITOR=vim +type nvim > /dev/null \ + && MANPAGER=manpager EDITOR=nvim GIT_EDITOR=nvim \ + && alias vim=nvim +export GPG_TTY=$TTY + +export CLICOLOR=1 +[[ "$OSTYPE" =~ 'linux-gnu' ]] \ + && alias ls='ls --color=auto' grep='grep --color' rm='rm -I' + +alias gs='git status --short --branch' gd='git diff' +alias gsh='git show' gl='git log --graph --pretty=log' +alias gco='git checkout' gb='git branch' gm='git merge' gst='git stash' +alias ga='git add' gmv='git mv' grm='git rm' +alias gc='git commit' gca='gc --amend' gt='git tag' +alias gp='git push' gu='git pull' gf='git fetch' +alias gr='git rebase' gra='gr --abort' grc='gr --continue' grs='gr --skip' + +nasd() { + local tmp=$(mktemp) + cat > $tmp + nasm -p =(echo 'bits 64') -o >(ndisasm -b 64 /dev/stdin) $tmp + rm $tmp +} + +setopt prompt_subst +_prompt_git() { + local dotgit=.git head + [ -d "$dotgit" ] || dotgit=../.git + [ -d "$dotgit" ] || return 0 + read head < "$dotgit/HEAD" + case "$head" in + ref:*) echo ":${head#*/*/}";; + *) echo ":${head:0:7}";; + esac +} +[ -n "$SSH_CLIENT" ] && _prompt_ssh='%F{magenta}' +PROMPT="%(?.%F{green}$_prompt_ssh.%F{red})»%f " +RPROMPT='%F{blue}%50<…<%~%F{yellow}$(_prompt_git)%f' + +_n() { _n() { echo } } +_title() { print -Pn "\e]0;$1\a" } +_title_precmd() { _title '%1~' } +_title_preexec() { psvar=("$1") _title '%1~: %1v' } +precmd_functions=(_n _title_precmd) +preexec_functions=(_title_preexec) -- cgit 1.4.1