diff --git a/web/src/app.css b/web/src/app.css index ee67f8b..d695d0d 100644 --- a/web/src/app.css +++ b/web/src/app.css @@ -198,11 +198,20 @@ input::placeholder { color: var(--fg-faint); } .cm-editor .cm-activeLine { background: color-mix(in srgb, var(--fg) 4%, transparent); } .cm-selectionBackground, .cm-content ::selection { background: var(--select) !important; } -/* Insert mode: a 2px bar reads far better than the browser's hairline caret. */ -.cm-cursor, .cm-cursor-primary { +/* + * Insert mode: a 2px bar reads far better than the browser's hairline caret. + * CodeMirror injects `.cm-cursor { border-left: 1.2px solid black }` after this + * stylesheet, so — like `.cm-activeLine` above — an equally specific selector + * loses and the caret renders black on a dark background. Qualify it to win. + */ +.cm-editor .cm-cursor, +.cm-editor .cm-cursor-primary, +.cm-editor .cm-dropCursor { border-left: 2px solid var(--accent); border-right: 0; + margin-left: -1px; } +.cm-editor .cm-cursor-secondary { border-left-color: var(--accent-dim); } /* * Normal mode: the vim plugin paints the character *inside* the block cursor, diff --git a/web/src/lib/Editor.svelte b/web/src/lib/Editor.svelte index cdf05d3..def954e 100644 --- a/web/src/lib/Editor.svelte +++ b/web/src/lib/Editor.svelte @@ -45,11 +45,12 @@ for (const spec of commands) { const names = [spec.name, ...(spec.aliases ?? [])] for (const name of names) { - if (name.includes('!')) continue Vim.defineEx(name, name, (_cm: unknown, params: { argString?: string }) => { const arg = (params.argString ?? '').trim() - // vim parses `:q!` as command `q` with the bang left in the arguments. - void runCommand(arg === '!' ? `${spec.name}!` : `${spec.name} ${arg}`) + // vim parses `:q!` as command `q` with the bang left in the arguments, + // so put it back on the name before handing the line over. + const bang = arg.startsWith('!') + void runCommand(`${spec.name}${bang ? '!' : ''} ${bang ? arg.slice(1).trim() : arg}`) }) } } diff --git a/web/src/lib/Help.svelte b/web/src/lib/Help.svelte index b6941e1..cf78d6e 100644 --- a/web/src/lib/Help.svelte +++ b/web/src/lib/Help.svelte @@ -46,6 +46,10 @@ {#if spec.args} {spec.args}{/if}