all repos — acme @ 232d3e06f6262c5c6e2aa015bfa0b6cae3047555

fork of the acme editor from plan9port - keybinds, tweaks, config.h, etc

add acme-lsp helpers and Toolbox, use COLOR_EMPTY more and dont lock windows when updating cursor (possibly dangerous, we'll see); v9001-a04
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmIYg1wACgkQO3+8IhRO
Y5iEjg//Yr+0c+lTiJ/FfEWmCo25okkeT/xuJz4KWikt3jqcoyhFDkcp7xPD+vJc
gpYgQyn0RmhEkU9HQdYK1dYDxHFaBbuLQPne2TImwHpLC2enK59a+sUUrds5luak
53/+HWQdV194jhIiLDLz73pZ1aqtHFnipdEPlztmQwH2ZrP55LbVi7nCrdtMla6D
DAtFXDvhtxVVnks9WWFWR/O7hFVnMHeR42Ko16/iC9zmPs5bo0K12Tx6cy8BKvd1
v1jbqO98GPRXh/3nTSIuk2ejSKt6Ujc881M/R9ZtD628oXZo40mb42p57TxN/0GH
jcIZss7qzk9p6Sr2yYV+DQrX0NR92qmt9HxFzkCa1fUPuICTJlpql4Rz32UYG/XI
bpJdrcFYDwPpAR6/jqdGp3Kqu2BfujWkfIvjfU8FirrVqymdWKGzGnbQjEaK10Sb
WsLBdmknZhazIpVjA/Khv2mFeWq0UUBrHB3AW/l+CA6sWTNXiBQGNw+S9gNEMcuN
sdXklSxwv6TNgBKIC6dzjQQKr0v+/KPAnsYCR3JZ/7BAXSzQtETlGfq812CmJOTh
kONQjPGd+8rUs4X7cP7ErwpFCOMb+tUcmW6B710PMRXtsZY9Mq3xml1kdnL4NqK+
HHQaANhU8pqI4C2vsykv9TiBaOlJzNUZNG60EU4smdimvMVg6aw=
=5jOp
-----END PGP SIGNATURE-----
commit

232d3e06f6262c5c6e2aa015bfa0b6cae3047555

parent

2b1cefce23fb3c94ec60796751b2853d3b7b6f6a

M README.mdREADME.md

@@ -44,9 +44,29 @@ ## install

After building, run `./install.sh`; If run as a regular user, it will install to `~/bin/9`; if run as root, it will overwrite the systemwide `acme` in `$PLAN9/bin` -## TODO +## helpers -- [ ] compile helpers +The `scripts` directory contains some helpers, mostly just shortcuts for [acme-lsp](https://github.com/fhs/acme-lsp). Copy them to your `$PATH` and let 'em rip. + +Of particular interest: + +- `agols`: pass a colon-separated list of workspaces to start `acme-lsp` for go development +- `atsls`: run without arguments to start `acme-lsp` for javascript/typescript development +- `acls`: run without arguments to start `acme-lsp` for C/C++ development + +For `acls` to work right with plan9port C stuff you will need to add your `$PLAN9/include` directory to the compile flags in either the project `.clangd` file or your `~/.config/clangd/config.yaml`: + +``` +CompileFlags: + Add: + - "-I/usr/lib/plan9/include" +``` + +See also: + +- [plumbing rules](https://nilfm.cc/git/dotfiles/tree/plumbing) - my plumbing rules, includes opening headers by right-click on the filename in an include directive + +The `Toolbox` file contains a compilation of `sam` command language (`Edit` scripts) that may be useful. ## thanks
A Toolbox

@@ -0,0 +1,8 @@

+# Compiled Edit scripts + +[ Edit 1,$-1d ] # clear win +[ Edit x/^[ ]*/ a/# / ] # comment (replace # with comment prefix) +[ Edit x/^[ ]*# ?/ x/# ?/d ] # uncomment (replace # with comment prefix) +[ Edit s/^[ ]//g ] # unindent +[ Edit s/^/ /g ] # indent +[ Edit x/[^\n]\n[^\n]/ s/\n/ / ] # join lines
M acme.cacme.c

@@ -43,7 +43,7 @@ Rune snarfrune[NSnarf + 1];

char* fontnames[2] = {PRIMARY_FONT, SECONDARY_FONT}; -char version[] = "acme9k v9001-a03"; +char version[] = "acme9k v9001-a04"; Command* command;

@@ -512,7 +512,7 @@ enum { MResize, MMouse, MPlumb, MWarnings, NMALT };

static Alt alts[NMALT + 1]; /* make sure we don't recklessly refresh the ticks */ - Text* oldbarttext; + Text* oldbarttext = nil; USED(v); threadsetname("mousethread");

@@ -676,8 +676,11 @@ goto Continue;

} Continue: /* won't refresh ticks if scrolling didn't change the active frame! */ - if (oldbarttext != barttext && (m.buttons) && t) { - textsettick(t, t->row); + if ( + (oldbarttext != barttext && (m.buttons & (8 | 16)) || + m.buttons & (1 | 2 | 4)) && + t) { + textsettick(barttext, &row); } qunlock(&row.lk); break;

@@ -988,7 +991,7 @@ 0x3F, 0xFF, 0xFF, 0xFC, 0x3F, 0xFF, 0xFF, 0xFC, 0x3F, 0xFF, 0xFF, 0xFC, 0x3F,

0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; void iconinit(void) { - Rectangle r, r1; + Rectangle r; Image* tmp; if (tagcols[BACK] == nil) {
M cols.ccols.c

@@ -11,6 +11,7 @@ #include <plumb.h>

#include <libsec.h> #include "dat.h" #include "fns.h" +#include "config.h" static Rune Lheader[] = {'N', 'e', 'w', ' ', 'C', 'u', 't', ' ', 'P', 'a', 's', 't', 'e', ' ', 'S', 'n', 'a', 'r', 'f', ' ',

@@ -24,7 +25,7 @@

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); c->r = r;

@@ -42,7 +43,7 @@ r1.max.y += Border;

draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); textinsert(t, 0, Lheader, 38, TRUE);

@@ -124,7 +125,7 @@ r1.max.y = r1.min.y + Border;

draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP);

@@ -192,7 +193,7 @@ if (c->nw == 0) {

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); return;

@@ -253,7 +254,7 @@ r1.max.y += Border;

draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1.max.y = r.max.y;

@@ -274,7 +275,7 @@ r2.max.y = r2.min.y + Border;

draw( screen, r2, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1.min.y = r2.max.y;

@@ -330,7 +331,7 @@ r1.max.y = r1.min.y + Border;

draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.y = r1.max.y;

@@ -431,7 +432,7 @@ r.max.y += Border;

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); y1 = r.max.y;

@@ -463,7 +464,7 @@ r.max.y += Border;

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); for (j = i + 1; j < c->nw; j++)

@@ -485,7 +486,7 @@ r.max.y += Border;

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); y1 = r.max.y;

@@ -572,7 +573,7 @@ r.max.y = r.min.y + Border;

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.y = r.max.y;
M config.def.hconfig.def.h

@@ -25,7 +25,7 @@

/* button colors: dirty file (mod) indicator and column handles */ #define COLOR_BTN_MD 0x1F9B92FF -#define COLOR_BTN_CO 0x586E75FF +#define COLOR_BTN_CO 0x002B36FF /* button 2 and 3 selection colors */
M look.clook.c

@@ -845,10 +845,11 @@ }

textshow(t, r.q0, r.q1, 1); winsettag(t->w); seltext = t; - if (e->jump) + if (e->jump) { moveto( mousectl, addpt(frptofchar(&t->fr, t->fr.p0), Pt(4, font->height - 4))); + } return w; }
M rows.crows.c

@@ -12,6 +12,7 @@ #include <plumb.h>

#include <libsec.h> #include "dat.h" #include "fns.h" +#include "config.h" static Rune Lcolhdr[] = {'N', 'e', 'w', 'c', 'o', 'l', ' ', 'K', 'i', 'l', 'l', ' ', 'P', 'u', 't', 'a', 'l', 'l', ' ', 'D',

@@ -24,7 +25,7 @@

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); row->r = r;

@@ -48,7 +49,7 @@ r1.max.y += Border;

draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); textinsert(t, 0, Lcolhdr, 29, TRUE);

@@ -82,7 +83,7 @@ return nil;

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1 = r;

@@ -95,7 +96,7 @@ r1.max.x = r1.min.x + Border;

draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.x = r1.max.x;

@@ -132,7 +133,7 @@ r1.max.y += Border;

draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.y = r1.max.y;

@@ -152,7 +153,7 @@ r2.max.x = r2.min.x + Border;

draw( screen, r2, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1.min.x = r2.max.x;

@@ -218,7 +219,7 @@ r.max.x = c->r.max.x;

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.max.x = p.x;

@@ -230,7 +231,7 @@ r.max.x += Border;

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.x = r.max.x;

@@ -258,7 +259,7 @@ if (row->ncol == 0) {

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); return;

@@ -274,7 +275,7 @@ }

draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); colresize(c, r);

@@ -633,7 +634,7 @@ continue;

draw( screen, Rpt(r1.min, r2.max), - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); colresize(c1, r1);

@@ -643,7 +644,7 @@ r2.max.x = x;

draw( screen, r2, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); }
A scripts/Lassist

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L assist
A scripts/Lcomp

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L comp
A scripts/Ldef

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L def
A scripts/Lfmt

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L fmt
A scripts/Lhov

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L hov
A scripts/Limpls

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L impls
A scripts/Lrefs

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L refs
A scripts/Lrn

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L rn
A scripts/Lsig

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L sig
A scripts/Lsyms

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L syms
A scripts/Ltype

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L type
A scripts/Lws

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L ws
A scripts/Lws+

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L ws+
A scripts/Lws-

@@ -0,0 +1,2 @@

+#!/bin/sh +exec L ws-
A scripts/acls

@@ -0,0 +1,3 @@

+#!/bin/sh +export CFLAGS="-I${PLAN9}/include" +exec acme-lsp -server '(\.c)|(\.h)|(\.cc)|(\.hh)|(\.cpp)|(\.hpp)$:clangd -log=error --background-index --limit-results=500 --completion-style=bundled'
A scripts/agols

@@ -0,0 +1,2 @@

+#!/bin/sh +exec acme-lsp -server '([/\\]go\.mod)|([/\\]go\.sum)|(\.go)$:gopls serve' -workspaces $@
A scripts/atsls

@@ -0,0 +1,2 @@

+#!/bin/sh +exec acme-lsp -server '(\.ts)|(\.js)|(\.jsx)|(\.tsx)$:typescript-language-server --stdio'
M text.ctext.c

@@ -59,10 +59,14 @@ cptr = allcolumns[ccnt];

_textsettick(t, &cptr->tag); for (wcnt = 0; wcnt < cptr->nw; wcnt++) { wptr = cptr->w[wcnt]; - winlock(wptr, 'M'); + /*if (!wptr->isdir) { + winlock(wptr, 'M'); + }*/ _textsettick(t, &wptr->tag); _textsettick(t, &wptr->body); - winunlock(wptr); + /*if (!wptr->isdir) { + winunlock(wptr); + }*/ } } /* force redraw to refresh all ticks;