@fresh-editor/fresh-editor 0.2.18 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -0
- package/package.json +1 -1
- package/plugins/config-schema.json +264 -42
- package/plugins/diagnostics_panel.ts +4 -12
- package/plugins/diff_nav.i18n.json +128 -0
- package/plugins/diff_nav.ts +196 -0
- package/plugins/git_explorer.ts +6 -0
- package/plugins/git_gutter.ts +5 -0
- package/plugins/lib/finder.ts +19 -12
- package/plugins/lib/fresh.d.ts +5 -1
- package/plugins/pkg.ts +4 -29
- package/plugins/schemas/package.schema.json +437 -272
- package/plugins/schemas/theme.schema.json +18 -0
- package/plugins/theme_editor.i18n.json +42 -14
- package/plugins/theme_editor.ts +30 -3
- package/plugins/vi_mode.ts +189 -51
- package/themes/high-contrast.json +66 -66
- package/themes/light.json +18 -18
package/plugins/vi_mode.ts
CHANGED
|
@@ -64,6 +64,14 @@ const state: ViState = {
|
|
|
64
64
|
visualBlockAnchor: null,
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
// Safe getBufferText that clamps end to buffer length
|
|
68
|
+
async function safeGetBufferText(bufferId: number, start: number, end: number): Promise<string | null> {
|
|
69
|
+
const bufLen = editor.getBufferLength(bufferId);
|
|
70
|
+
const clampedEnd = Math.min(end, bufLen);
|
|
71
|
+
if (clampedEnd <= start) return null;
|
|
72
|
+
return editor.getBufferText(bufferId, start, clampedEnd);
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
// Mode indicator for status bar
|
|
68
76
|
function getModeIndicator(mode: ViMode): string {
|
|
69
77
|
const countPrefix = state.count !== null ? `${state.count} ` : "";
|
|
@@ -179,7 +187,11 @@ function getCount(): number {
|
|
|
179
187
|
// Returns the count (defaults to 1)
|
|
180
188
|
function consumeCount(): number {
|
|
181
189
|
const count = state.count ?? 1;
|
|
182
|
-
state.count
|
|
190
|
+
if (state.count !== null) {
|
|
191
|
+
state.count = null;
|
|
192
|
+
// Update status to clear the count display
|
|
193
|
+
editor.setStatus(getModeIndicator(state.mode));
|
|
194
|
+
}
|
|
183
195
|
return count;
|
|
184
196
|
}
|
|
185
197
|
|
|
@@ -212,6 +224,7 @@ const motionToSelection: Record<string, string> = {
|
|
|
212
224
|
move_down: "select_down",
|
|
213
225
|
move_word_left: "select_word_left",
|
|
214
226
|
move_word_right: "select_word_right",
|
|
227
|
+
vi_move_word_end: "vi_select_word_end",
|
|
215
228
|
move_line_start: "select_line_start",
|
|
216
229
|
move_line_end: "select_line_end",
|
|
217
230
|
move_document_start: "select_document_start",
|
|
@@ -227,6 +240,7 @@ const atomicOperatorActions: OperatorMotionMap = {
|
|
|
227
240
|
// Delete operators
|
|
228
241
|
move_word_right: "delete_word_forward",
|
|
229
242
|
move_word_left: "delete_word_backward",
|
|
243
|
+
vi_move_word_end: "delete_vi_word_end",
|
|
230
244
|
move_line_end: "delete_to_line_end",
|
|
231
245
|
move_line_start: "delete_to_line_start",
|
|
232
246
|
},
|
|
@@ -234,6 +248,7 @@ const atomicOperatorActions: OperatorMotionMap = {
|
|
|
234
248
|
// Yank operators
|
|
235
249
|
move_word_right: "yank_word_forward",
|
|
236
250
|
move_word_left: "yank_word_backward",
|
|
251
|
+
vi_move_word_end: "yank_vi_word_end",
|
|
237
252
|
move_line_end: "yank_to_line_end",
|
|
238
253
|
move_line_start: "yank_to_line_start",
|
|
239
254
|
},
|
|
@@ -325,7 +340,8 @@ function handleMotionWithOperator(motionAction: string): void {
|
|
|
325
340
|
|
|
326
341
|
// Navigation (all support count prefix, e.g., 5j moves down 5 lines)
|
|
327
342
|
function vi_left() : void {
|
|
328
|
-
|
|
343
|
+
// h — line-bounded move left (vim doesn't wrap across lines)
|
|
344
|
+
executeWithCount("move_left_in_line");
|
|
329
345
|
}
|
|
330
346
|
registerHandler("vi_left", vi_left);
|
|
331
347
|
|
|
@@ -340,7 +356,8 @@ function vi_up() : void {
|
|
|
340
356
|
registerHandler("vi_up", vi_up);
|
|
341
357
|
|
|
342
358
|
function vi_right() : void {
|
|
343
|
-
|
|
359
|
+
// l — line-bounded move right (vim doesn't wrap across lines)
|
|
360
|
+
executeWithCount("move_right_in_line");
|
|
344
361
|
}
|
|
345
362
|
registerHandler("vi_right", vi_right);
|
|
346
363
|
|
|
@@ -355,12 +372,8 @@ function vi_word_back() : void {
|
|
|
355
372
|
registerHandler("vi_word_back", vi_word_back);
|
|
356
373
|
|
|
357
374
|
function vi_word_end() : void {
|
|
358
|
-
//
|
|
359
|
-
|
|
360
|
-
for (let i = 0; i < count; i++) {
|
|
361
|
-
editor.executeAction("move_word_right");
|
|
362
|
-
editor.executeAction("move_left");
|
|
363
|
-
}
|
|
375
|
+
// Vim 'e' motion — uses native vi_move_word_end action
|
|
376
|
+
executeWithCount("vi_move_word_end");
|
|
364
377
|
}
|
|
365
378
|
registerHandler("vi_word_end", vi_word_end);
|
|
366
379
|
|
|
@@ -373,13 +386,36 @@ registerHandler("vi_line_start", vi_line_start);
|
|
|
373
386
|
function vi_line_end() : void {
|
|
374
387
|
consumeCount(); // Count doesn't apply to line end
|
|
375
388
|
editor.executeAction("move_line_end");
|
|
389
|
+
// In vim normal mode, cursor should be ON the last char, not past it
|
|
390
|
+
// move_line_end goes past the last char; move_left corrects this
|
|
391
|
+
editor.executeAction("move_left");
|
|
376
392
|
}
|
|
377
393
|
registerHandler("vi_line_end", vi_line_end);
|
|
378
394
|
|
|
379
|
-
function vi_first_non_blank() : void {
|
|
395
|
+
async function vi_first_non_blank() : Promise<void> {
|
|
380
396
|
consumeCount(); // Count doesn't apply
|
|
381
|
-
|
|
382
|
-
|
|
397
|
+
// Get line start position directly (avoids stale snapshot from executeAction)
|
|
398
|
+
const line = editor.getCursorLine();
|
|
399
|
+
const bufferId = editor.getActiveBufferId();
|
|
400
|
+
const lineStart = await editor.getLineStartPosition(line);
|
|
401
|
+
if (lineStart === null) {
|
|
402
|
+
editor.executeAction("move_line_start");
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const text = await safeGetBufferText(bufferId, lineStart, lineStart + 200);
|
|
406
|
+
if (text) {
|
|
407
|
+
let offset = 0;
|
|
408
|
+
while (offset < text.length && (text[offset] === ' ' || text[offset] === '\t')) {
|
|
409
|
+
offset++;
|
|
410
|
+
}
|
|
411
|
+
if (offset < text.length && text[offset] !== '\n' && text[offset] !== '\r') {
|
|
412
|
+
editor.setBufferCursor(bufferId, lineStart + offset);
|
|
413
|
+
} else {
|
|
414
|
+
editor.setBufferCursor(bufferId, lineStart);
|
|
415
|
+
}
|
|
416
|
+
} else {
|
|
417
|
+
editor.executeAction("move_line_start");
|
|
418
|
+
}
|
|
383
419
|
}
|
|
384
420
|
registerHandler("vi_first_non_blank", vi_first_non_blank);
|
|
385
421
|
|
|
@@ -390,8 +426,22 @@ function vi_doc_start() : void {
|
|
|
390
426
|
registerHandler("vi_doc_start", vi_doc_start);
|
|
391
427
|
|
|
392
428
|
function vi_doc_end() : void {
|
|
393
|
-
|
|
394
|
-
|
|
429
|
+
const count = state.count;
|
|
430
|
+
consumeCount();
|
|
431
|
+
if (count !== null) {
|
|
432
|
+
// nG = go to line n (1-indexed; goto_line expects 0-indexed internally)
|
|
433
|
+
// Use setBufferCursor to move to line start via getLineStartPosition
|
|
434
|
+
const line = count - 1; // Convert to 0-indexed
|
|
435
|
+
editor.getLineStartPosition(line).then((pos) => {
|
|
436
|
+
if (pos !== null) {
|
|
437
|
+
editor.setBufferCursor(editor.getActiveBufferId(), pos);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
} else {
|
|
441
|
+
editor.executeAction("move_document_end");
|
|
442
|
+
}
|
|
443
|
+
// Update status to clear any count display
|
|
444
|
+
editor.setStatus(getModeIndicator(state.mode));
|
|
395
445
|
}
|
|
396
446
|
registerHandler("vi_doc_end", vi_doc_end);
|
|
397
447
|
|
|
@@ -489,13 +539,10 @@ registerHandler("vi_delete_line", vi_delete_line);
|
|
|
489
539
|
function vi_change_line() : void {
|
|
490
540
|
const count = consumeCount();
|
|
491
541
|
state.lastChange = { type: "line-op", action: "change_line", count };
|
|
542
|
+
// Select from line start to line end, then cut (avoids stale snapshot issue)
|
|
492
543
|
editor.executeAction("move_line_start");
|
|
493
|
-
|
|
494
|
-
editor.executeAction("
|
|
495
|
-
const end = editor.getCursorPosition();
|
|
496
|
-
if (start !== null && end !== null) {
|
|
497
|
-
editor.deleteRange(editor.getActiveBufferId(), start, end);
|
|
498
|
-
}
|
|
544
|
+
editor.executeAction("select_line_end");
|
|
545
|
+
editor.executeAction("cut");
|
|
499
546
|
switchMode("insert");
|
|
500
547
|
}
|
|
501
548
|
registerHandler("vi_change_line", vi_change_line);
|
|
@@ -535,11 +582,27 @@ function vi_delete_char_before() : void {
|
|
|
535
582
|
registerHandler("vi_delete_char_before", vi_delete_char_before);
|
|
536
583
|
|
|
537
584
|
function vi_replace_char() : void {
|
|
538
|
-
//
|
|
539
|
-
|
|
585
|
+
// Enter replace-char mode to read the replacement character
|
|
586
|
+
state.mode = "find-char"; // Reuse find-char mode mechanism
|
|
587
|
+
editor.setEditorMode("vi-replace-char");
|
|
588
|
+
editor.setStatus("-- REPLACE CHAR --");
|
|
540
589
|
}
|
|
541
590
|
registerHandler("vi_replace_char", vi_replace_char);
|
|
542
591
|
|
|
592
|
+
// Handler for replacement character input
|
|
593
|
+
async function vi_replace_char_handler(char: string): Promise<void> {
|
|
594
|
+
const count = consumeCount();
|
|
595
|
+
// Replace character(s) under cursor without moving
|
|
596
|
+
for (let i = 0; i < count; i++) {
|
|
597
|
+
editor.executeAction("delete_forward");
|
|
598
|
+
editor.insertAtCursor(char);
|
|
599
|
+
}
|
|
600
|
+
// Move cursor back to stay on the replaced char (vim behavior)
|
|
601
|
+
editor.executeAction("move_left");
|
|
602
|
+
switchMode("normal");
|
|
603
|
+
}
|
|
604
|
+
registerHandler("vi_replace_char_handler", vi_replace_char_handler);
|
|
605
|
+
|
|
543
606
|
// Substitute (delete char and enter insert mode)
|
|
544
607
|
function vi_substitute() : void {
|
|
545
608
|
const count = consumeCount();
|
|
@@ -553,27 +616,19 @@ function vi_substitute() : void {
|
|
|
553
616
|
}
|
|
554
617
|
registerHandler("vi_substitute", vi_substitute);
|
|
555
618
|
|
|
556
|
-
// Delete to end of line
|
|
619
|
+
// Delete to end of line (D)
|
|
557
620
|
function vi_delete_to_end() : void {
|
|
558
621
|
state.lastChange = { type: "operator-motion", operator: "d", motion: "move_line_end" };
|
|
559
|
-
|
|
560
|
-
editor.executeAction("
|
|
561
|
-
const end = editor.getCursorPosition();
|
|
562
|
-
if (start !== null && end !== null && end > start) {
|
|
563
|
-
editor.deleteRange(editor.getActiveBufferId(), start, end);
|
|
564
|
-
}
|
|
622
|
+
// Use the atomic delete_to_line_end action to avoid stale snapshot issues
|
|
623
|
+
editor.executeAction("delete_to_line_end");
|
|
565
624
|
}
|
|
566
625
|
registerHandler("vi_delete_to_end", vi_delete_to_end);
|
|
567
626
|
|
|
568
|
-
// Change to end of line
|
|
627
|
+
// Change to end of line (C)
|
|
569
628
|
function vi_change_to_end() : void {
|
|
570
629
|
state.lastChange = { type: "operator-motion", operator: "c", motion: "move_line_end" };
|
|
571
|
-
|
|
572
|
-
editor.executeAction("
|
|
573
|
-
const end = editor.getCursorPosition();
|
|
574
|
-
if (start !== null && end !== null && end > start) {
|
|
575
|
-
editor.deleteRange(editor.getActiveBufferId(), start, end);
|
|
576
|
-
}
|
|
630
|
+
// Use the atomic delete_to_line_end action to avoid stale snapshot issues
|
|
631
|
+
editor.executeAction("delete_to_line_end");
|
|
577
632
|
switchMode("insert");
|
|
578
633
|
}
|
|
579
634
|
registerHandler("vi_change_to_end", vi_change_to_end);
|
|
@@ -665,14 +720,10 @@ async function vi_repeat() : Promise<void> {
|
|
|
665
720
|
editor.executeAction("delete_line");
|
|
666
721
|
}
|
|
667
722
|
} else if (change.action === "change_line") {
|
|
668
|
-
// Change line:
|
|
723
|
+
// Change line: select line content, cut, insert text
|
|
669
724
|
editor.executeAction("move_line_start");
|
|
670
|
-
|
|
671
|
-
editor.executeAction("
|
|
672
|
-
const end = editor.getCursorPosition();
|
|
673
|
-
if (start !== null && end !== null) {
|
|
674
|
-
editor.deleteRange(editor.getActiveBufferId(), start, end);
|
|
675
|
-
}
|
|
725
|
+
editor.executeAction("select_line_end");
|
|
726
|
+
editor.executeAction("cut");
|
|
676
727
|
if (change.insertedText) {
|
|
677
728
|
editor.insertAtCursor(change.insertedText);
|
|
678
729
|
}
|
|
@@ -721,14 +772,22 @@ async function vi_repeat() : Promise<void> {
|
|
|
721
772
|
}
|
|
722
773
|
registerHandler("vi_repeat", vi_repeat);
|
|
723
774
|
|
|
724
|
-
// Join lines
|
|
775
|
+
// Join lines — delete newline at end of current line and insert a space
|
|
725
776
|
function vi_join() : void {
|
|
726
777
|
editor.executeAction("move_line_end");
|
|
778
|
+
// Delete the newline character
|
|
727
779
|
editor.executeAction("delete_forward");
|
|
728
|
-
|
|
780
|
+
// Insert a space between the joined content
|
|
781
|
+
editor.insertAtCursor(" ");
|
|
729
782
|
}
|
|
730
783
|
registerHandler("vi_join", vi_join);
|
|
731
784
|
|
|
785
|
+
// Toggle case (~) — uses native toggle_case action
|
|
786
|
+
function vi_toggle_case() : void {
|
|
787
|
+
executeWithCount("toggle_case");
|
|
788
|
+
}
|
|
789
|
+
registerHandler("vi_toggle_case", vi_toggle_case);
|
|
790
|
+
|
|
732
791
|
// Search
|
|
733
792
|
function vi_search_forward() : void {
|
|
734
793
|
editor.executeAction("search");
|
|
@@ -822,7 +881,9 @@ registerHandler("vi_op_digit_0_or_line_start", vi_op_digit_0_or_line_start);
|
|
|
822
881
|
// Enter character-wise visual mode
|
|
823
882
|
function vi_visual_char() : void {
|
|
824
883
|
state.visualAnchor = editor.getCursorPosition();
|
|
825
|
-
// Select
|
|
884
|
+
// Select the character under cursor to establish the anchor.
|
|
885
|
+
// This moves cursor one position right (the selection end), which is
|
|
886
|
+
// standard visual mode behavior — the first char is part of the selection.
|
|
826
887
|
editor.executeAction("select_right");
|
|
827
888
|
switchMode("visual");
|
|
828
889
|
}
|
|
@@ -831,8 +892,7 @@ registerHandler("vi_visual_char", vi_visual_char);
|
|
|
831
892
|
// Enter line-wise visual mode
|
|
832
893
|
function vi_visual_line() : void {
|
|
833
894
|
state.visualAnchor = editor.getCursorPosition();
|
|
834
|
-
// Select
|
|
835
|
-
editor.executeAction("move_line_start");
|
|
895
|
+
// Select full line including newline (select_line selects and moves to next line)
|
|
836
896
|
editor.executeAction("select_line");
|
|
837
897
|
switchMode("visual-line");
|
|
838
898
|
}
|
|
@@ -989,6 +1049,7 @@ function vi_vis_word_back() : void {
|
|
|
989
1049
|
registerHandler("vi_vis_word_back", vi_vis_word_back);
|
|
990
1050
|
|
|
991
1051
|
function vi_vis_word_end() : void {
|
|
1052
|
+
// Extend selection to end of word
|
|
992
1053
|
const count = consumeCount();
|
|
993
1054
|
for (let i = 0; i < count; i++) {
|
|
994
1055
|
editor.executeAction("select_word_right");
|
|
@@ -1557,6 +1618,13 @@ function vi_op_word_back(): void {
|
|
|
1557
1618
|
}
|
|
1558
1619
|
registerHandler("vi_op_word_back", vi_op_word_back);
|
|
1559
1620
|
|
|
1621
|
+
// Operator-pending e (word end) - select to word end, then apply operator
|
|
1622
|
+
// Operator-pending e (word end) — uses native vi_move_word_end motion
|
|
1623
|
+
function vi_op_word_end(): void {
|
|
1624
|
+
handleMotionWithOperator("vi_move_word_end");
|
|
1625
|
+
}
|
|
1626
|
+
registerHandler("vi_op_word_end", vi_op_word_end);
|
|
1627
|
+
|
|
1560
1628
|
function vi_op_line_start(): void {
|
|
1561
1629
|
handleMotionWithOperator("move_line_start");
|
|
1562
1630
|
}
|
|
@@ -1680,6 +1748,7 @@ editor.defineMode("vi-normal", [
|
|
|
1680
1748
|
|
|
1681
1749
|
// Other
|
|
1682
1750
|
["J", "vi_join"],
|
|
1751
|
+
["~", "vi_toggle_case"],
|
|
1683
1752
|
|
|
1684
1753
|
// Command mode
|
|
1685
1754
|
[":", "vi_command_mode"],
|
|
@@ -1829,6 +1898,24 @@ registerHandler("vi_fc_9", vi_fc_9);
|
|
|
1829
1898
|
async function vi_fc_space(): Promise<void> { return vi_find_char_handler(" "); }
|
|
1830
1899
|
registerHandler("vi_fc_space", vi_fc_space);
|
|
1831
1900
|
|
|
1901
|
+
// Punctuation character handlers for find-char mode
|
|
1902
|
+
const punctuationChars: [string, string][] = [
|
|
1903
|
+
["!", "excl"], ["@", "at"], ["#", "hash"], ["$", "dollar"], ["%", "percent"],
|
|
1904
|
+
["^", "caret"], ["&", "amp"], ["*", "star"], ["(", "lparen"], [")", "rparen"],
|
|
1905
|
+
["-", "minus"], ["_", "underscore"], ["=", "equals"], ["+", "plus"],
|
|
1906
|
+
["[", "lbracket"], ["]", "rbracket"], ["{", "lbrace"], ["}", "rbrace"],
|
|
1907
|
+
["\\", "backslash"], ["|", "pipe"], [";", "semi"], [":", "colon"],
|
|
1908
|
+
["'", "squote"], ["\"", "dquote"], [",", "comma"], [".", "dot"],
|
|
1909
|
+
["<", "lt"], [">", "gt"], ["/", "slash"], ["?", "question"], ["`", "backtick"],
|
|
1910
|
+
["~", "tilde"],
|
|
1911
|
+
];
|
|
1912
|
+
|
|
1913
|
+
for (const [char, name] of punctuationChars) {
|
|
1914
|
+
const handlerName = `vi_fc_p_${name}`;
|
|
1915
|
+
const handler = async (): Promise<void> => { return vi_find_char_handler(char); };
|
|
1916
|
+
registerHandler(handlerName, handler);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1832
1919
|
// Define vi-find-char mode with all the character bindings
|
|
1833
1920
|
editor.defineMode("vi-find-char", [
|
|
1834
1921
|
["Escape", "vi_find_char_cancel"],
|
|
@@ -1851,8 +1938,56 @@ editor.defineMode("vi-find-char", [
|
|
|
1851
1938
|
["0", "vi_fc_0"], ["1", "vi_fc_1"], ["2", "vi_fc_2"], ["3", "vi_fc_3"],
|
|
1852
1939
|
["4", "vi_fc_4"], ["5", "vi_fc_5"], ["6", "vi_fc_6"], ["7", "vi_fc_7"],
|
|
1853
1940
|
["8", "vi_fc_8"], ["9", "vi_fc_9"],
|
|
1854
|
-
//
|
|
1941
|
+
// Space and punctuation
|
|
1855
1942
|
["Space", "vi_fc_space"],
|
|
1943
|
+
["!", "vi_fc_p_excl"], ["@", "vi_fc_p_at"], ["#", "vi_fc_p_hash"],
|
|
1944
|
+
["$", "vi_fc_p_dollar"], ["%", "vi_fc_p_percent"], ["^", "vi_fc_p_caret"],
|
|
1945
|
+
["&", "vi_fc_p_amp"], ["*", "vi_fc_p_star"], ["(", "vi_fc_p_lparen"],
|
|
1946
|
+
[")", "vi_fc_p_rparen"], ["-", "vi_fc_p_minus"], ["_", "vi_fc_p_underscore"],
|
|
1947
|
+
["=", "vi_fc_p_equals"], ["+", "vi_fc_p_plus"], ["[", "vi_fc_p_lbracket"],
|
|
1948
|
+
["]", "vi_fc_p_rbracket"], ["{", "vi_fc_p_lbrace"], ["}", "vi_fc_p_rbrace"],
|
|
1949
|
+
["\\", "vi_fc_p_backslash"], ["|", "vi_fc_p_pipe"], [";", "vi_fc_p_semi"],
|
|
1950
|
+
[":", "vi_fc_p_colon"], ["'", "vi_fc_p_squote"], ["\"", "vi_fc_p_dquote"],
|
|
1951
|
+
[",", "vi_fc_p_comma"], [".", "vi_fc_p_dot"], ["<", "vi_fc_p_lt"],
|
|
1952
|
+
[">", "vi_fc_p_gt"], ["/", "vi_fc_p_slash"], ["?", "vi_fc_p_question"],
|
|
1953
|
+
["`", "vi_fc_p_backtick"], ["~", "vi_fc_p_tilde"],
|
|
1954
|
+
], true);
|
|
1955
|
+
|
|
1956
|
+
// Define vi-replace-char mode — reuses find-char handlers but calls vi_replace_char_handler
|
|
1957
|
+
// We create replace-char specific handlers that delegate to the replace handler
|
|
1958
|
+
const rcHandlers: [string, string][] = [];
|
|
1959
|
+
for (const c of "abcdefghijklmnopqrstuvwxyz") {
|
|
1960
|
+
const name = `vi_rc_${c}`;
|
|
1961
|
+
const handler = async (): Promise<void> => { return vi_replace_char_handler(c); };
|
|
1962
|
+
registerHandler(name, handler);
|
|
1963
|
+
rcHandlers.push([c, name]);
|
|
1964
|
+
}
|
|
1965
|
+
for (const c of "ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
|
|
1966
|
+
const name = `vi_rc_${c}`;
|
|
1967
|
+
const handler = async (): Promise<void> => { return vi_replace_char_handler(c); };
|
|
1968
|
+
registerHandler(name, handler);
|
|
1969
|
+
rcHandlers.push([c, name]);
|
|
1970
|
+
}
|
|
1971
|
+
for (const c of "0123456789") {
|
|
1972
|
+
const name = `vi_rc_d${c}`;
|
|
1973
|
+
const handler = async (): Promise<void> => { return vi_replace_char_handler(c); };
|
|
1974
|
+
registerHandler(name, handler);
|
|
1975
|
+
rcHandlers.push([c, name]);
|
|
1976
|
+
}
|
|
1977
|
+
// Space and common punctuation for replace-char mode
|
|
1978
|
+
const rcSpaceHandler = async (): Promise<void> => { return vi_replace_char_handler(" "); };
|
|
1979
|
+
registerHandler("vi_rc_space", rcSpaceHandler);
|
|
1980
|
+
for (const [char, pname] of punctuationChars) {
|
|
1981
|
+
const name = `vi_rc_p_${pname}`;
|
|
1982
|
+
const handler = async (): Promise<void> => { return vi_replace_char_handler(char); };
|
|
1983
|
+
registerHandler(name, handler);
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
editor.defineMode("vi-replace-char", [
|
|
1987
|
+
["Escape", "vi_find_char_cancel"],
|
|
1988
|
+
...rcHandlers.map(([key, name]): [string, string] => [key, name]),
|
|
1989
|
+
["Space", "vi_rc_space"],
|
|
1990
|
+
...punctuationChars.map(([char, pname]): [string, string] => [char, `vi_rc_p_${pname}`]),
|
|
1856
1991
|
], true);
|
|
1857
1992
|
|
|
1858
1993
|
// Define vi-operator-pending mode
|
|
@@ -1876,6 +2011,7 @@ editor.defineMode("vi-operator-pending", [
|
|
|
1876
2011
|
["l", "vi_op_right"],
|
|
1877
2012
|
["w", "vi_op_word"],
|
|
1878
2013
|
["b", "vi_op_word_back"],
|
|
2014
|
+
["e", "vi_op_word_end"],
|
|
1879
2015
|
["$", "vi_op_line_end"],
|
|
1880
2016
|
["g g", "vi_op_doc_start"],
|
|
1881
2017
|
["G", "vi_op_doc_end"],
|
|
@@ -1948,8 +2084,9 @@ editor.defineMode("vi-visual", [
|
|
|
1948
2084
|
["g g", "vi_vis_doc_start"],
|
|
1949
2085
|
["G", "vi_vis_doc_end"],
|
|
1950
2086
|
|
|
1951
|
-
// Switch
|
|
2087
|
+
// Switch visual sub-modes
|
|
1952
2088
|
["V", "vi_visual_toggle_line"],
|
|
2089
|
+
["C-v", "vi_visual_block"], // Switch to block mode
|
|
1953
2090
|
|
|
1954
2091
|
// Operators
|
|
1955
2092
|
["d", "vi_vis_delete"],
|
|
@@ -1986,8 +2123,9 @@ editor.defineMode("vi-visual-line", [
|
|
|
1986
2123
|
["g g", "vi_vis_doc_start"],
|
|
1987
2124
|
["G", "vi_vis_doc_end"],
|
|
1988
2125
|
|
|
1989
|
-
// Switch
|
|
2126
|
+
// Switch visual sub-modes
|
|
1990
2127
|
["v", "vi_visual_toggle_line"],
|
|
2128
|
+
["C-v", "vi_visual_block"], // Switch to block mode
|
|
1991
2129
|
|
|
1992
2130
|
// Operators
|
|
1993
2131
|
["d", "vi_vis_delete"],
|
|
@@ -1,103 +1,103 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "high-contrast",
|
|
3
3
|
"editor": {
|
|
4
|
-
"bg":
|
|
5
|
-
"fg":
|
|
6
|
-
"cursor":
|
|
7
|
-
"inactive_cursor":
|
|
4
|
+
"bg": [0, 0, 0],
|
|
5
|
+
"fg": [255, 255, 255],
|
|
6
|
+
"cursor": [255, 255, 255],
|
|
7
|
+
"inactive_cursor": [127, 127, 127],
|
|
8
8
|
"selection_bg": [0, 100, 200],
|
|
9
9
|
"current_line_bg": [20, 20, 20],
|
|
10
10
|
"line_number_fg": [140, 140, 140],
|
|
11
|
-
"line_number_bg":
|
|
12
|
-
"diff_add_bg": [0,
|
|
13
|
-
"diff_remove_bg": [
|
|
11
|
+
"line_number_bg": [0, 0, 0],
|
|
12
|
+
"diff_add_bg": [0, 35, 0],
|
|
13
|
+
"diff_remove_bg": [50, 0, 0],
|
|
14
14
|
"diff_modify_bg": [25, 22, 0],
|
|
15
15
|
"whitespace_indicator_fg": [80, 80, 80]
|
|
16
16
|
},
|
|
17
17
|
"ui": {
|
|
18
|
-
"tab_active_fg":
|
|
19
|
-
"tab_active_bg":
|
|
20
|
-
"tab_inactive_fg":
|
|
21
|
-
"tab_inactive_bg":
|
|
18
|
+
"tab_active_fg": [0, 0, 0],
|
|
19
|
+
"tab_active_bg": [255, 255, 0],
|
|
20
|
+
"tab_inactive_fg": [255, 255, 255],
|
|
21
|
+
"tab_inactive_bg": [0, 0, 0],
|
|
22
22
|
"tab_separator_bg": [30, 30, 35],
|
|
23
23
|
"tab_close_hover_fg": [249, 38, 114],
|
|
24
24
|
"tab_hover_bg": [50, 50, 55],
|
|
25
25
|
"menu_bg": [50, 50, 55],
|
|
26
|
-
"menu_fg":
|
|
27
|
-
"menu_active_bg":
|
|
28
|
-
"menu_active_fg":
|
|
26
|
+
"menu_fg": [255, 255, 255],
|
|
27
|
+
"menu_active_bg": [255, 255, 0],
|
|
28
|
+
"menu_active_fg": [0, 0, 0],
|
|
29
29
|
"menu_dropdown_bg": [20, 20, 20],
|
|
30
|
-
"menu_dropdown_fg":
|
|
30
|
+
"menu_dropdown_fg": [255, 255, 255],
|
|
31
31
|
"menu_highlight_bg": [0, 100, 200],
|
|
32
|
-
"menu_highlight_fg":
|
|
33
|
-
"menu_border_fg":
|
|
34
|
-
"menu_separator_fg":
|
|
32
|
+
"menu_highlight_fg": [255, 255, 255],
|
|
33
|
+
"menu_border_fg": [255, 255, 0],
|
|
34
|
+
"menu_separator_fg": [255, 255, 255],
|
|
35
35
|
"menu_hover_bg": [50, 50, 50],
|
|
36
|
-
"menu_hover_fg":
|
|
37
|
-
"menu_disabled_fg":
|
|
36
|
+
"menu_hover_fg": [255, 255, 0],
|
|
37
|
+
"menu_disabled_fg": [127, 127, 127],
|
|
38
38
|
"menu_disabled_bg": [20, 20, 20],
|
|
39
|
-
"status_bar_fg":
|
|
39
|
+
"status_bar_fg": [255, 255, 255],
|
|
40
40
|
"status_bar_bg": [20, 20, 20],
|
|
41
|
-
"prompt_fg":
|
|
41
|
+
"prompt_fg": [255, 255, 255],
|
|
42
42
|
"prompt_bg": [10, 10, 10],
|
|
43
|
-
"prompt_selection_fg":
|
|
43
|
+
"prompt_selection_fg": [255, 255, 255],
|
|
44
44
|
"prompt_selection_bg": [0, 100, 200],
|
|
45
|
-
"popup_border_fg":
|
|
46
|
-
"popup_bg":
|
|
45
|
+
"popup_border_fg": [0, 255, 255],
|
|
46
|
+
"popup_bg": [0, 0, 0],
|
|
47
47
|
"popup_selection_bg": [0, 100, 200],
|
|
48
|
-
"popup_text_fg":
|
|
49
|
-
"suggestion_bg":
|
|
48
|
+
"popup_text_fg": [255, 255, 255],
|
|
49
|
+
"suggestion_bg": [0, 0, 0],
|
|
50
50
|
"suggestion_selected_bg": [0, 100, 200],
|
|
51
|
-
"help_bg":
|
|
52
|
-
"help_fg":
|
|
53
|
-
"help_key_fg":
|
|
54
|
-
"help_separator_fg":
|
|
55
|
-
"help_indicator_fg":
|
|
56
|
-
"help_indicator_bg":
|
|
51
|
+
"help_bg": [0, 0, 0],
|
|
52
|
+
"help_fg": [255, 255, 255],
|
|
53
|
+
"help_key_fg": [0, 255, 255],
|
|
54
|
+
"help_separator_fg": [255, 255, 255],
|
|
55
|
+
"help_indicator_fg": [255, 80, 80],
|
|
56
|
+
"help_indicator_bg": [0, 0, 0],
|
|
57
57
|
"inline_code_bg": [40, 40, 40],
|
|
58
58
|
"split_separator_fg": [140, 140, 140],
|
|
59
|
-
"split_separator_hover_fg":
|
|
60
|
-
"scrollbar_track_fg":
|
|
61
|
-
"scrollbar_thumb_fg":
|
|
62
|
-
"scrollbar_track_hover_fg":
|
|
63
|
-
"scrollbar_thumb_hover_fg":
|
|
59
|
+
"split_separator_hover_fg": [255, 255, 0],
|
|
60
|
+
"scrollbar_track_fg": [255, 255, 255],
|
|
61
|
+
"scrollbar_thumb_fg": [255, 255, 0],
|
|
62
|
+
"scrollbar_track_hover_fg": [255, 255, 0],
|
|
63
|
+
"scrollbar_thumb_hover_fg": [0, 255, 255],
|
|
64
64
|
"compose_margin_bg": [10, 10, 10],
|
|
65
|
-
"semantic_highlight_bg": [0,
|
|
65
|
+
"semantic_highlight_bg": [0, 25, 55],
|
|
66
66
|
"terminal_bg": "Default",
|
|
67
67
|
"terminal_fg": "Default",
|
|
68
|
-
"status_warning_indicator_bg":
|
|
69
|
-
"status_warning_indicator_fg":
|
|
70
|
-
"status_error_indicator_bg":
|
|
71
|
-
"status_error_indicator_fg":
|
|
72
|
-
"status_warning_indicator_hover_bg":
|
|
73
|
-
"status_warning_indicator_hover_fg":
|
|
74
|
-
"status_error_indicator_hover_bg":
|
|
75
|
-
"status_error_indicator_hover_fg":
|
|
68
|
+
"status_warning_indicator_bg": [255, 255, 0],
|
|
69
|
+
"status_warning_indicator_fg": [0, 0, 0],
|
|
70
|
+
"status_error_indicator_bg": [255, 60, 60],
|
|
71
|
+
"status_error_indicator_fg": [255, 255, 255],
|
|
72
|
+
"status_warning_indicator_hover_bg": [255, 255, 100],
|
|
73
|
+
"status_warning_indicator_hover_fg": [0, 0, 0],
|
|
74
|
+
"status_error_indicator_hover_bg": [255, 100, 100],
|
|
75
|
+
"status_error_indicator_hover_fg": [255, 255, 255],
|
|
76
76
|
"tab_drop_zone_bg": [0, 100, 200],
|
|
77
|
-
"tab_drop_zone_border":
|
|
77
|
+
"tab_drop_zone_border": [255, 255, 0]
|
|
78
78
|
},
|
|
79
79
|
"search": {
|
|
80
|
-
"match_bg":
|
|
81
|
-
"match_fg":
|
|
80
|
+
"match_bg": [255, 255, 0],
|
|
81
|
+
"match_fg": [0, 0, 0]
|
|
82
82
|
},
|
|
83
83
|
"diagnostic": {
|
|
84
|
-
"error_fg":
|
|
85
|
-
"error_bg": [
|
|
86
|
-
"warning_fg":
|
|
87
|
-
"warning_bg": [
|
|
88
|
-
"info_fg":
|
|
89
|
-
"info_bg": [0,
|
|
90
|
-
"hint_fg":
|
|
91
|
-
"hint_bg": [
|
|
84
|
+
"error_fg": [255, 80, 80],
|
|
85
|
+
"error_bg": [50, 0, 0],
|
|
86
|
+
"warning_fg": [255, 255, 0],
|
|
87
|
+
"warning_bg": [35, 30, 0],
|
|
88
|
+
"info_fg": [0, 255, 255],
|
|
89
|
+
"info_bg": [0, 25, 55],
|
|
90
|
+
"hint_fg": [255, 255, 255],
|
|
91
|
+
"hint_bg": [30, 30, 30]
|
|
92
92
|
},
|
|
93
93
|
"syntax": {
|
|
94
|
-
"keyword":
|
|
95
|
-
"string":
|
|
96
|
-
"comment":
|
|
97
|
-
"function":
|
|
98
|
-
"type":
|
|
99
|
-
"variable":
|
|
100
|
-
"constant":
|
|
101
|
-
"operator":
|
|
94
|
+
"keyword": [0, 255, 255],
|
|
95
|
+
"string": [0, 205, 0],
|
|
96
|
+
"comment": [229, 229, 229],
|
|
97
|
+
"function": [255, 255, 0],
|
|
98
|
+
"type": [255, 85, 255],
|
|
99
|
+
"variable": [255, 255, 255],
|
|
100
|
+
"constant": [120, 130, 255],
|
|
101
|
+
"operator": [255, 255, 255]
|
|
102
102
|
}
|
|
103
103
|
}
|
package/themes/light.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"inactive_cursor": [180, 180, 180],
|
|
8
8
|
"selection_bg": [173, 214, 255],
|
|
9
9
|
"current_line_bg": [245, 245, 245],
|
|
10
|
-
"line_number_fg": [
|
|
10
|
+
"line_number_fg": [115, 115, 115],
|
|
11
11
|
"line_number_bg": [255, 255, 255],
|
|
12
12
|
"diff_add_bg": [200, 255, 200],
|
|
13
13
|
"diff_remove_bg": [255, 200, 200],
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"menu_hover_fg": [0, 0, 0],
|
|
37
37
|
"menu_disabled_fg": [160, 160, 160],
|
|
38
38
|
"menu_disabled_bg": [248, 248, 248],
|
|
39
|
-
"status_bar_fg":
|
|
39
|
+
"status_bar_fg": [0, 0, 0],
|
|
40
40
|
"status_bar_bg": [220, 220, 220],
|
|
41
|
-
"prompt_fg":
|
|
41
|
+
"prompt_fg": [0, 0, 0],
|
|
42
42
|
"prompt_bg": [230, 240, 250],
|
|
43
|
-
"prompt_selection_fg":
|
|
43
|
+
"prompt_selection_fg": [0, 0, 0],
|
|
44
44
|
"prompt_selection_bg": [173, 214, 255],
|
|
45
45
|
"popup_border_fg": [140, 140, 140],
|
|
46
46
|
"popup_bg": [232, 238, 245],
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"popup_text_fg": [30, 30, 30],
|
|
49
49
|
"suggestion_bg": [232, 238, 245],
|
|
50
50
|
"suggestion_selected_bg": [209, 226, 243],
|
|
51
|
-
"help_bg":
|
|
52
|
-
"help_fg":
|
|
53
|
-
"help_key_fg":
|
|
54
|
-
"help_separator_fg":
|
|
55
|
-
"help_indicator_fg":
|
|
56
|
-
"help_indicator_bg":
|
|
51
|
+
"help_bg": [255, 255, 255],
|
|
52
|
+
"help_fg": [0, 0, 0],
|
|
53
|
+
"help_key_fg": [0, 0, 180],
|
|
54
|
+
"help_separator_fg": [170, 170, 170],
|
|
55
|
+
"help_indicator_fg": [200, 30, 30],
|
|
56
|
+
"help_indicator_bg": [255, 255, 255],
|
|
57
57
|
"inline_code_bg": [230, 230, 235],
|
|
58
58
|
"split_separator_fg": [140, 140, 140],
|
|
59
59
|
"split_separator_hover_fg": [70, 130, 180],
|
|
@@ -81,14 +81,14 @@
|
|
|
81
81
|
"match_fg": [0, 0, 0]
|
|
82
82
|
},
|
|
83
83
|
"diagnostic": {
|
|
84
|
-
"error_fg":
|
|
85
|
-
"error_bg": [255,
|
|
86
|
-
"warning_fg": [
|
|
87
|
-
"warning_bg": [255,
|
|
88
|
-
"info_fg":
|
|
89
|
-
"info_bg": [
|
|
90
|
-
"hint_fg":
|
|
91
|
-
"hint_bg": [
|
|
84
|
+
"error_fg": [180, 0, 0],
|
|
85
|
+
"error_bg": [255, 210, 210],
|
|
86
|
+
"warning_fg": [150, 110, 0],
|
|
87
|
+
"warning_bg": [255, 248, 170],
|
|
88
|
+
"info_fg": [0, 0, 180],
|
|
89
|
+
"info_bg": [210, 230, 255],
|
|
90
|
+
"hint_fg": [100, 100, 100],
|
|
91
|
+
"hint_bg": [235, 235, 240]
|
|
92
92
|
},
|
|
93
93
|
"syntax": {
|
|
94
94
|
"keyword": [175, 0, 219],
|