@fresh-editor/fresh-editor 0.1.65 → 0.1.69

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +4 -2
  3. package/package.json +1 -1
  4. package/plugins/audit_mode.i18n.json +380 -0
  5. package/plugins/audit_mode.ts +1813 -0
  6. package/plugins/buffer_modified.i18n.json +32 -0
  7. package/plugins/buffer_modified.ts +5 -3
  8. package/plugins/calculator.i18n.json +44 -0
  9. package/plugins/calculator.ts +6 -4
  10. package/plugins/clangd-lsp.ts +168 -0
  11. package/plugins/clangd_support.i18n.json +104 -0
  12. package/plugins/clangd_support.ts +18 -16
  13. package/plugins/color_highlighter.i18n.json +68 -0
  14. package/plugins/color_highlighter.ts +12 -10
  15. package/plugins/config-schema.json +79 -141
  16. package/plugins/csharp-lsp.ts +147 -0
  17. package/plugins/csharp_support.i18n.json +38 -0
  18. package/plugins/csharp_support.ts +6 -4
  19. package/plugins/css-lsp.ts +143 -0
  20. package/plugins/diagnostics_panel.i18n.json +110 -0
  21. package/plugins/diagnostics_panel.ts +19 -17
  22. package/plugins/find_references.i18n.json +128 -0
  23. package/plugins/find_references.ts +22 -20
  24. package/plugins/git_blame.i18n.json +230 -0
  25. package/plugins/git_blame.ts +39 -37
  26. package/plugins/git_find_file.i18n.json +146 -0
  27. package/plugins/git_find_file.ts +24 -22
  28. package/plugins/git_grep.i18n.json +80 -0
  29. package/plugins/git_grep.ts +15 -13
  30. package/plugins/git_gutter.i18n.json +44 -0
  31. package/plugins/git_gutter.ts +7 -5
  32. package/plugins/git_log.i18n.json +224 -0
  33. package/plugins/git_log.ts +41 -39
  34. package/plugins/go-lsp.ts +143 -0
  35. package/plugins/html-lsp.ts +145 -0
  36. package/plugins/json-lsp.ts +145 -0
  37. package/plugins/lib/fresh.d.ts +150 -14
  38. package/plugins/lib/index.ts +1 -1
  39. package/plugins/lib/navigation-controller.ts +3 -3
  40. package/plugins/lib/panel-manager.ts +15 -13
  41. package/plugins/lib/virtual-buffer-factory.ts +84 -112
  42. package/plugins/live_grep.i18n.json +80 -0
  43. package/plugins/live_grep.ts +15 -13
  44. package/plugins/markdown_compose.i18n.json +104 -0
  45. package/plugins/markdown_compose.ts +17 -15
  46. package/plugins/merge_conflict.i18n.json +380 -0
  47. package/plugins/merge_conflict.ts +72 -73
  48. package/plugins/path_complete.i18n.json +38 -0
  49. package/plugins/path_complete.ts +6 -4
  50. package/plugins/python-lsp.ts +162 -0
  51. package/plugins/rust-lsp.ts +166 -0
  52. package/plugins/search_replace.i18n.json +188 -0
  53. package/plugins/search_replace.ts +31 -29
  54. package/plugins/test_i18n.i18n.json +12 -0
  55. package/plugins/test_i18n.ts +18 -0
  56. package/plugins/theme_editor.i18n.json +1417 -0
  57. package/plugins/theme_editor.ts +73 -69
  58. package/plugins/todo_highlighter.i18n.json +86 -0
  59. package/plugins/todo_highlighter.ts +15 -13
  60. package/plugins/typescript-lsp.ts +167 -0
  61. package/plugins/vi_mode.i18n.json +716 -0
  62. package/plugins/vi_mode.ts +2747 -0
  63. package/plugins/welcome.i18n.json +110 -0
  64. package/plugins/welcome.ts +18 -16
@@ -29,130 +29,102 @@ export interface SplitBufferOptions extends VirtualBufferOptions {
29
29
  }
30
30
 
31
31
  /**
32
- * VirtualBufferFactory - Simplified virtual buffer creation
33
- *
34
- * Provides convenience methods for creating virtual buffers with
35
- * sensible defaults for read-only panel views.
32
+ * Create a VirtualBufferFactory bound to a specific editor instance.
36
33
  *
37
34
  * @example
38
35
  * ```typescript
39
- * // Create buffer as a tab in current split (e.g., help, manual)
40
- * const bufferId = await VirtualBufferFactory.create({
36
+ * const editor = getEditor();
37
+ * const bufferFactory = createVirtualBufferFactory(editor);
38
+ *
39
+ * // Create buffer as a tab in current split
40
+ * const bufferId = await bufferFactory.create({
41
41
  * name: "*Help*",
42
42
  * mode: "help-manual",
43
43
  * entries: helpEntries,
44
44
  * });
45
- *
46
- * // Create buffer in existing split (e.g., commit detail view)
47
- * const bufferId = await VirtualBufferFactory.createInSplit(splitId, {
48
- * name: "*Commit Details*",
49
- * mode: "git-commit-detail",
50
- * entries: detailEntries,
51
- * });
52
- *
53
- * // Create buffer in new split
54
- * const bufferId = await VirtualBufferFactory.createWithSplit({
55
- * name: "*References*",
56
- * mode: "references-list",
57
- * entries: refEntries,
58
- * ratio: 0.4,
59
- * });
60
45
  * ```
61
46
  */
62
- export const VirtualBufferFactory = {
63
- /**
64
- * Create a virtual buffer as a new tab in the current split
65
- * This is ideal for documentation, help panels, and content that should
66
- * appear alongside other buffers rather than in a separate split.
67
- *
68
- * @param options - Buffer configuration
69
- * @returns Buffer ID
70
- */
71
- async create(options: VirtualBufferOptions): Promise<number> {
72
- const {
73
- name,
74
- mode,
75
- entries,
76
- showLineNumbers = false,
77
- editingDisabled = true,
78
- readOnly = true,
79
- } = options;
47
+ export function createVirtualBufferFactory(editor: EditorAPI) {
48
+ return {
49
+ /**
50
+ * Create a virtual buffer as a new tab in the current split
51
+ */
52
+ async create(options: VirtualBufferOptions): Promise<number> {
53
+ const {
54
+ name,
55
+ mode,
56
+ entries,
57
+ showLineNumbers = false,
58
+ editingDisabled = true,
59
+ readOnly = true,
60
+ } = options;
80
61
 
81
- return await editor.createVirtualBuffer({
82
- name,
83
- mode,
84
- read_only: readOnly,
85
- entries,
86
- show_line_numbers: showLineNumbers,
87
- editing_disabled: editingDisabled,
88
- });
89
- },
62
+ return await editor.createVirtualBuffer({
63
+ name,
64
+ mode,
65
+ read_only: readOnly,
66
+ entries,
67
+ show_line_numbers: showLineNumbers,
68
+ editing_disabled: editingDisabled,
69
+ });
70
+ },
90
71
 
91
- /**
92
- * Create a virtual buffer in an existing split
93
- *
94
- * @param splitId - Target split ID
95
- * @param options - Buffer configuration
96
- * @returns Buffer ID
97
- */
98
- async createInSplit(splitId: number, options: VirtualBufferOptions): Promise<number> {
99
- const {
100
- name,
101
- mode,
102
- entries,
103
- showLineNumbers = false,
104
- editingDisabled = true,
105
- readOnly = true,
106
- } = options;
72
+ /**
73
+ * Create a virtual buffer in an existing split
74
+ */
75
+ async createInSplit(splitId: number, options: VirtualBufferOptions): Promise<number> {
76
+ const {
77
+ name,
78
+ mode,
79
+ entries,
80
+ showLineNumbers = false,
81
+ editingDisabled = true,
82
+ readOnly = true,
83
+ } = options;
107
84
 
108
- return await editor.createVirtualBufferInExistingSplit({
109
- name,
110
- mode,
111
- read_only: readOnly,
112
- entries,
113
- split_id: splitId,
114
- show_line_numbers: showLineNumbers,
115
- editing_disabled: editingDisabled,
116
- });
117
- },
85
+ return await editor.createVirtualBufferInExistingSplit({
86
+ name,
87
+ mode,
88
+ read_only: readOnly,
89
+ entries,
90
+ split_id: splitId,
91
+ show_line_numbers: showLineNumbers,
92
+ editing_disabled: editingDisabled,
93
+ });
94
+ },
118
95
 
119
- /**
120
- * Create a virtual buffer in a new split
121
- *
122
- * @param options - Buffer and split configuration
123
- * @returns Buffer ID
124
- */
125
- async createWithSplit(options: SplitBufferOptions): Promise<number> {
126
- const {
127
- name,
128
- mode,
129
- entries,
130
- ratio = 0.3,
131
- panelId,
132
- showLineNumbers = false,
133
- editingDisabled = true,
134
- readOnly = true,
135
- } = options;
96
+ /**
97
+ * Create a virtual buffer in a new split
98
+ */
99
+ async createWithSplit(options: SplitBufferOptions): Promise<number> {
100
+ const {
101
+ name,
102
+ mode,
103
+ entries,
104
+ ratio = 0.3,
105
+ panelId,
106
+ showLineNumbers = false,
107
+ editingDisabled = true,
108
+ readOnly = true,
109
+ } = options;
136
110
 
137
- return await editor.createVirtualBufferInSplit({
138
- name,
139
- mode,
140
- read_only: readOnly,
141
- entries,
142
- ratio,
143
- panel_id: panelId,
144
- show_line_numbers: showLineNumbers,
145
- editing_disabled: editingDisabled,
146
- });
147
- },
111
+ return await editor.createVirtualBufferInSplit({
112
+ name,
113
+ mode,
114
+ read_only: readOnly,
115
+ entries,
116
+ ratio,
117
+ panel_id: panelId,
118
+ show_line_numbers: showLineNumbers,
119
+ editing_disabled: editingDisabled,
120
+ });
121
+ },
148
122
 
149
- /**
150
- * Update content of an existing virtual buffer
151
- *
152
- * @param bufferId - Buffer to update
153
- * @param entries - New entries
154
- */
155
- updateContent(bufferId: number, entries: TextPropertyEntry[]): void {
156
- editor.setVirtualBufferContent(bufferId, entries);
157
- },
158
- };
123
+ /**
124
+ * Update content of an existing virtual buffer
125
+ */
126
+ updateContent(bufferId: number, entries: TextPropertyEntry[]): void {
127
+ editor.setVirtualBufferContent(bufferId, entries);
128
+ },
129
+ };
130
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "en": {
3
+ "cmd.live_grep": "Live Grep (Find in Files)",
4
+ "cmd.live_grep_desc": "Search for text across project with live preview",
5
+ "status.ready": "Live Grep ready - use command palette or bind 'start_live_grep'",
6
+ "status.type_to_search": "Type to search (min 2 chars)...",
7
+ "status.found_matches": "Found {count} matches",
8
+ "status.no_matches": "No matches found",
9
+ "status.search_error": "Search error: {error}",
10
+ "status.opened_file": "Opened {file}:{line}",
11
+ "status.no_file_selected": "No file selected",
12
+ "status.cancelled": "Live grep cancelled",
13
+ "prompt.live_grep": "Live grep: "
14
+ },
15
+ "es": {
16
+ "cmd.live_grep": "Grep en Vivo (Buscar en Archivos)",
17
+ "cmd.live_grep_desc": "Buscar texto en todo el proyecto con vista previa en vivo",
18
+ "status.ready": "Grep en Vivo listo - usa la paleta de comandos o asigna 'start_live_grep'",
19
+ "status.type_to_search": "Escribe para buscar (min 2 caracteres)...",
20
+ "status.found_matches": "Se encontraron {count} coincidencias",
21
+ "status.no_matches": "No se encontraron coincidencias",
22
+ "status.search_error": "Error de búsqueda: {error}",
23
+ "status.opened_file": "Abierto {file}:{line}",
24
+ "status.no_file_selected": "Ningún archivo seleccionado",
25
+ "status.cancelled": "Grep en vivo cancelado",
26
+ "prompt.live_grep": "Grep en vivo: "
27
+ },
28
+ "de": {
29
+ "cmd.live_grep": "Live Grep (Suche in Dateien)",
30
+ "cmd.live_grep_desc": "Text im gesamten Projekt mit Live-Vorschau suchen",
31
+ "status.ready": "Live Grep bereit - Befehlspalette verwenden oder 'start_live_grep' binden",
32
+ "status.type_to_search": "Tippen zum Suchen (min. 2 Zeichen)...",
33
+ "status.found_matches": "{count} Treffer gefunden",
34
+ "status.no_matches": "Keine Treffer gefunden",
35
+ "status.search_error": "Suchfehler: {error}",
36
+ "status.opened_file": "{file}:{line} geöffnet",
37
+ "status.no_file_selected": "Keine Datei ausgewählt",
38
+ "status.cancelled": "Live Grep abgebrochen",
39
+ "prompt.live_grep": "Live Grep: "
40
+ },
41
+ "fr": {
42
+ "cmd.live_grep": "Grep en Direct (Rechercher dans les Fichiers)",
43
+ "cmd.live_grep_desc": "Rechercher du texte dans tout le projet avec aperçu en direct",
44
+ "status.ready": "Grep en Direct prêt - utilisez la palette de commandes ou liez 'start_live_grep'",
45
+ "status.type_to_search": "Tapez pour rechercher (min 2 caractères)...",
46
+ "status.found_matches": "{count} correspondances trouvées",
47
+ "status.no_matches": "Aucune correspondance trouvée",
48
+ "status.search_error": "Erreur de recherche : {error}",
49
+ "status.opened_file": "Ouvert {file}:{line}",
50
+ "status.no_file_selected": "Aucun fichier sélectionné",
51
+ "status.cancelled": "Grep en direct annulé",
52
+ "prompt.live_grep": "Grep en direct : "
53
+ },
54
+ "ja": {
55
+ "cmd.live_grep": "ライブ Grep (ファイル内検索)",
56
+ "cmd.live_grep_desc": "プロジェクト全体をライブプレビュー付きで検索",
57
+ "status.ready": "ライブ Grep 準備完了 - コマンドパレットを使用するか 'start_live_grep' をバインド",
58
+ "status.type_to_search": "検索するには入力してください (最小2文字)...",
59
+ "status.found_matches": "{count} 件の一致が見つかりました",
60
+ "status.no_matches": "一致するものが見つかりません",
61
+ "status.search_error": "検索エラー: {error}",
62
+ "status.opened_file": "{file}:{line} を開きました",
63
+ "status.no_file_selected": "ファイルが選択されていません",
64
+ "status.cancelled": "ライブ grep がキャンセルされました",
65
+ "prompt.live_grep": "ライブ grep: "
66
+ },
67
+ "zh": {
68
+ "cmd.live_grep": "实时 Grep (文件内搜索)",
69
+ "cmd.live_grep_desc": "在整个项目中搜索文本并实时预览",
70
+ "status.ready": "实时 Grep 已就绪 - 使用命令面板或绑定 'start_live_grep'",
71
+ "status.type_to_search": "输入以搜索 (最少2个字符)...",
72
+ "status.found_matches": "找到 {count} 个匹配项",
73
+ "status.no_matches": "未找到匹配项",
74
+ "status.search_error": "搜索错误: {error}",
75
+ "status.opened_file": "已打开 {file}:{line}",
76
+ "status.no_file_selected": "未选择文件",
77
+ "status.cancelled": "实时 grep 已取消",
78
+ "prompt.live_grep": "实时 grep: "
79
+ }
80
+ }
@@ -1,4 +1,6 @@
1
1
  /// <reference path="./lib/fresh.d.ts" />
2
+ const editor = getEditor();
3
+
2
4
 
3
5
  /**
4
6
  * Live Grep Plugin
@@ -264,31 +266,31 @@ async function runSearch(query: string): Promise<void> {
264
266
  editor.setPromptSuggestions(suggestions);
265
267
 
266
268
  if (results.length > 0) {
267
- editor.setStatus(`Found ${results.length} matches`);
269
+ editor.setStatus(editor.t("status.found_matches", { count: String(results.length) }));
268
270
  // Show preview of first result
269
271
  await updatePreview(results[0]);
270
272
  } else {
271
- editor.setStatus("No matches found");
273
+ editor.setStatus(editor.t("status.no_matches"));
272
274
  }
273
275
  } else if (result.exit_code === 1) {
274
276
  // No matches
275
277
  editor.debug(`[live_grep] no matches (exit_code=1)`);
276
278
  grepResults = [];
277
279
  editor.setPromptSuggestions([]);
278
- editor.setStatus("No matches found");
280
+ editor.setStatus(editor.t("status.no_matches"));
279
281
  } else if (result.exit_code === -1) {
280
282
  // Process was killed, ignore
281
283
  editor.debug(`[live_grep] process was killed`);
282
284
  } else {
283
285
  editor.debug(`[live_grep] search error: ${result.stderr}`);
284
- editor.setStatus(`Search error: ${result.stderr}`);
286
+ editor.setStatus(editor.t("status.search_error", { error: result.stderr }));
285
287
  }
286
288
  } catch (e) {
287
289
  // Ignore errors from killed processes
288
290
  const errorMsg = String(e);
289
291
  editor.debug(`[live_grep] caught error: ${errorMsg}`);
290
292
  if (!errorMsg.includes("killed") && !errorMsg.includes("not found")) {
291
- editor.setStatus(`Search error: ${e}`);
293
+ editor.setStatus(editor.t("status.search_error", { error: String(e) }));
292
294
  }
293
295
  }
294
296
  }
@@ -304,8 +306,8 @@ globalThis.start_live_grep = function (): void {
304
306
  originalSplitId = editor.getActiveSplitId();
305
307
 
306
308
  // Start the prompt
307
- editor.startPrompt("Live grep: ", "live-grep");
308
- editor.setStatus("Type to search (min 2 chars)...");
309
+ editor.startPrompt(editor.t("prompt.live_grep"), "live-grep");
310
+ editor.setStatus(editor.t("status.type_to_search"));
309
311
  };
310
312
 
311
313
  // Handle prompt input changes
@@ -365,9 +367,9 @@ globalThis.onLiveGrepPromptConfirmed = function (args: {
365
367
  if (args.selected_index !== null && grepResults[args.selected_index]) {
366
368
  const selected = grepResults[args.selected_index];
367
369
  editor.openFile(selected.file, selected.line, selected.column);
368
- editor.setStatus(`Opened ${selected.file}:${selected.line}`);
370
+ editor.setStatus(editor.t("status.opened_file", { file: selected.file, line: String(selected.line) }));
369
371
  } else {
370
- editor.setStatus("No file selected");
372
+ editor.setStatus(editor.t("status.no_file_selected"));
371
373
  }
372
374
 
373
375
  // Clear state
@@ -397,7 +399,7 @@ globalThis.onLiveGrepPromptCancelled = function (args: {
397
399
  grepResults = [];
398
400
  originalSplitId = null;
399
401
  previewSplitId = null;
400
- editor.setStatus("Live grep cancelled");
402
+ editor.setStatus(editor.t("status.cancelled"));
401
403
 
402
404
  return true;
403
405
  };
@@ -410,11 +412,11 @@ editor.on("prompt_cancelled", "onLiveGrepPromptCancelled");
410
412
 
411
413
  // Register command
412
414
  editor.registerCommand(
413
- "Live Grep (Find in Files)",
414
- "Search for text across project with live preview",
415
+ "%cmd.live_grep",
416
+ "%cmd.live_grep_desc",
415
417
  "start_live_grep",
416
418
  "normal"
417
419
  );
418
420
 
419
421
  editor.debug("Live Grep plugin loaded");
420
- editor.setStatus("Live Grep ready - use command palette or bind 'start_live_grep'");
422
+ editor.setStatus(editor.t("status.ready"));
@@ -0,0 +1,104 @@
1
+ {
2
+ "en": {
3
+ "cmd.toggle_compose": "Markdown: Toggle Compose",
4
+ "cmd.toggle_compose_desc": "Toggle compose mode (soft wrapping, centered margins)",
5
+ "cmd.set_compose_width": "Markdown: Set Compose Width",
6
+ "cmd.set_compose_width_desc": "Set the width for compose mode wrapping and margins",
7
+ "status.plugin_ready": "Markdown plugin ready",
8
+ "status.not_markdown_file": "Not a Markdown file",
9
+ "status.compose_off": "Markdown Compose: OFF",
10
+ "status.compose_on": "Markdown Compose: ON (soft breaks, centered)",
11
+ "status.width_set": "Markdown compose width set to {width}",
12
+ "status.invalid_width": "Invalid width - must be between 20 and 300",
13
+ "prompt.compose_width": "Compose width: ",
14
+ "suggestion.narrow": "Narrow - good for side panels",
15
+ "suggestion.classic": "Classic - traditional terminal width",
16
+ "suggestion.standard": "Standard - default width",
17
+ "suggestion.wide": "Wide - more content per line"
18
+ },
19
+ "es": {
20
+ "cmd.toggle_compose": "Markdown: Alternar Composicion",
21
+ "cmd.toggle_compose_desc": "Alternar modo de composicion (ajuste suave, margenes centrados)",
22
+ "cmd.set_compose_width": "Markdown: Establecer Ancho de Composicion",
23
+ "cmd.set_compose_width_desc": "Establecer el ancho para el ajuste y margenes del modo de composicion",
24
+ "status.plugin_ready": "Plugin Markdown listo",
25
+ "status.not_markdown_file": "No es un archivo Markdown",
26
+ "status.compose_off": "Composicion Markdown: DESACTIVADA",
27
+ "status.compose_on": "Composicion Markdown: ACTIVADA (saltos suaves, centrado)",
28
+ "status.width_set": "Ancho de composicion Markdown establecido en {width}",
29
+ "status.invalid_width": "Ancho invalido - debe estar entre 20 y 300",
30
+ "prompt.compose_width": "Ancho de composicion: ",
31
+ "suggestion.narrow": "Estrecho - bueno para paneles laterales",
32
+ "suggestion.classic": "Clasico - ancho de terminal tradicional",
33
+ "suggestion.standard": "Estandar - ancho predeterminado",
34
+ "suggestion.wide": "Amplio - mas contenido por linea"
35
+ },
36
+ "de": {
37
+ "cmd.toggle_compose": "Markdown: Kompositionsmodus umschalten",
38
+ "cmd.toggle_compose_desc": "Kompositionsmodus umschalten (weicher Umbruch, zentrierte Rander)",
39
+ "cmd.set_compose_width": "Markdown: Kompositionsbreite festlegen",
40
+ "cmd.set_compose_width_desc": "Breite fur Umbruch und Rander im Kompositionsmodus festlegen",
41
+ "status.plugin_ready": "Markdown-Plugin bereit",
42
+ "status.not_markdown_file": "Keine Markdown-Datei",
43
+ "status.compose_off": "Markdown-Komposition: AUS",
44
+ "status.compose_on": "Markdown-Komposition: AN (weiche Umbruche, zentriert)",
45
+ "status.width_set": "Markdown-Kompositionsbreite auf {width} gesetzt",
46
+ "status.invalid_width": "Ungultige Breite - muss zwischen 20 und 300 liegen",
47
+ "prompt.compose_width": "Kompositionsbreite: ",
48
+ "suggestion.narrow": "Schmal - gut fur Seitenpanels",
49
+ "suggestion.classic": "Klassisch - traditionelle Terminalbreite",
50
+ "suggestion.standard": "Standard - Standardbreite",
51
+ "suggestion.wide": "Breit - mehr Inhalt pro Zeile"
52
+ },
53
+ "fr": {
54
+ "cmd.toggle_compose": "Markdown: Basculer la Composition",
55
+ "cmd.toggle_compose_desc": "Basculer le mode composition (retour a la ligne souple, marges centrees)",
56
+ "cmd.set_compose_width": "Markdown: Definir la Largeur de Composition",
57
+ "cmd.set_compose_width_desc": "Definir la largeur pour le retour a la ligne et les marges du mode composition",
58
+ "status.plugin_ready": "Plugin Markdown pret",
59
+ "status.not_markdown_file": "Ce n'est pas un fichier Markdown",
60
+ "status.compose_off": "Composition Markdown: DESACTIVEE",
61
+ "status.compose_on": "Composition Markdown: ACTIVEE (sauts souples, centre)",
62
+ "status.width_set": "Largeur de composition Markdown definie a {width}",
63
+ "status.invalid_width": "Largeur invalide - doit etre entre 20 et 300",
64
+ "prompt.compose_width": "Largeur de composition: ",
65
+ "suggestion.narrow": "Etroit - bon pour les panneaux lateraux",
66
+ "suggestion.classic": "Classique - largeur de terminal traditionnelle",
67
+ "suggestion.standard": "Standard - largeur par defaut",
68
+ "suggestion.wide": "Large - plus de contenu par ligne"
69
+ },
70
+ "ja": {
71
+ "cmd.toggle_compose": "Markdown: 作成モード切り替え",
72
+ "cmd.toggle_compose_desc": "作成モードを切り替え(ソフトラップ、中央揃えマージン)",
73
+ "cmd.set_compose_width": "Markdown: 作成幅を設定",
74
+ "cmd.set_compose_width_desc": "作成モードの折り返しとマージンの幅を設定",
75
+ "status.plugin_ready": "Markdownプラグイン準備完了",
76
+ "status.not_markdown_file": "Markdownファイルではありません",
77
+ "status.compose_off": "Markdown作成: オフ",
78
+ "status.compose_on": "Markdown作成: オン(ソフト改行、中央揃え)",
79
+ "status.width_set": "Markdown作成幅を{width}に設定しました",
80
+ "status.invalid_width": "無効な幅 - 20から300の間である必要があります",
81
+ "prompt.compose_width": "作成幅: ",
82
+ "suggestion.narrow": "狭い - サイドパネルに最適",
83
+ "suggestion.classic": "クラシック - 従来のターミナル幅",
84
+ "suggestion.standard": "標準 - デフォルト幅",
85
+ "suggestion.wide": "広い - 1行あたりのコンテンツが増加"
86
+ },
87
+ "zh": {
88
+ "cmd.toggle_compose": "Markdown: 切换撰写模式",
89
+ "cmd.toggle_compose_desc": "切换撰写模式(软换行,居中边距)",
90
+ "cmd.set_compose_width": "Markdown: 设置撰写宽度",
91
+ "cmd.set_compose_width_desc": "设置撰写模式的换行和边距宽度",
92
+ "status.plugin_ready": "Markdown插件就绪",
93
+ "status.not_markdown_file": "不是Markdown文件",
94
+ "status.compose_off": "Markdown撰写: 关闭",
95
+ "status.compose_on": "Markdown撰写: 开启(软换行,居中)",
96
+ "status.width_set": "Markdown撰写宽度已设置为{width}",
97
+ "status.invalid_width": "无效宽度 - 必须在20到300之间",
98
+ "prompt.compose_width": "撰写宽度: ",
99
+ "suggestion.narrow": "窄 - 适合侧边面板",
100
+ "suggestion.classic": "经典 - 传统终端宽度",
101
+ "suggestion.standard": "标准 - 默认宽度",
102
+ "suggestion.wide": "宽 - 每行更多内容"
103
+ }
104
+ }
@@ -6,6 +6,8 @@
6
6
  //
7
7
  // Syntax highlighting is handled by the TextMate grammar (built-in to the editor)
8
8
  // This plugin only adds the compose mode layout features.
9
+ const editor = getEditor();
10
+
9
11
 
10
12
  interface MarkdownConfig {
11
13
  composeWidth: number;
@@ -364,18 +366,18 @@ globalThis.markdownToggleCompose = function(): void {
364
366
 
365
367
  // Only work with markdown files
366
368
  if (!info.path.endsWith('.md') && !info.path.endsWith('.markdown')) {
367
- editor.setStatus("Not a Markdown file");
369
+ editor.setStatus(editor.t("status.not_markdown_file"));
368
370
  return;
369
371
  }
370
372
 
371
373
  if (composeBuffers.has(bufferId)) {
372
374
  disableMarkdownCompose(bufferId);
373
- editor.setStatus("Markdown Compose: OFF");
375
+ editor.setStatus(editor.t("status.compose_off"));
374
376
  } else {
375
377
  enableMarkdownCompose(bufferId);
376
378
  // Trigger a re-render to apply the transform
377
379
  editor.refreshLines(bufferId);
378
- editor.setStatus("Markdown Compose: ON (soft breaks, centered)");
380
+ editor.setStatus(editor.t("status.compose_on"));
379
381
  }
380
382
  };
381
383
 
@@ -577,12 +579,12 @@ editor.on("prompt_confirmed", "onMarkdownComposeWidthConfirmed");
577
579
 
578
580
  // Set compose width command - starts interactive prompt
579
581
  globalThis.markdownSetComposeWidth = function(): void {
580
- editor.startPrompt("Compose width: ", "markdown-compose-width");
582
+ editor.startPrompt(editor.t("prompt.compose_width"), "markdown-compose-width");
581
583
  editor.setPromptSuggestions([
582
- { text: "60", description: "Narrow - good for side panels" },
583
- { text: "72", description: "Classic - traditional terminal width" },
584
- { text: "80", description: "Standard - default width" },
585
- { text: "100", description: "Wide - more content per line" },
584
+ { text: "60", description: editor.t("suggestion.narrow") },
585
+ { text: "72", description: editor.t("suggestion.classic") },
586
+ { text: "80", description: editor.t("suggestion.standard") },
587
+ { text: "100", description: editor.t("suggestion.wide") },
586
588
  ]);
587
589
  };
588
590
 
@@ -596,7 +598,7 @@ globalThis.onMarkdownComposeWidthConfirmed = function(args: {
596
598
  const width = parseInt(args.text, 10);
597
599
  if (!isNaN(width) && width > 20 && width < 300) {
598
600
  config.composeWidth = width;
599
- editor.setStatus(`Markdown compose width set to ${width}`);
601
+ editor.setStatus(editor.t("status.width_set", { width: String(width) }));
600
602
 
601
603
  // Re-process active buffer if in compose mode
602
604
  const bufferId = editor.getActiveBufferId();
@@ -604,25 +606,25 @@ globalThis.onMarkdownComposeWidthConfirmed = function(args: {
604
606
  editor.refreshLines(bufferId); // Trigger re-transform
605
607
  }
606
608
  } else {
607
- editor.setStatus("Invalid width - must be between 20 and 300");
609
+ editor.setStatus(editor.t("status.invalid_width"));
608
610
  }
609
611
  };
610
612
 
611
613
  // Register commands
612
614
  editor.registerCommand(
613
- "Markdown: Toggle Compose",
614
- "Toggle compose mode (soft wrapping, centered margins)",
615
+ "%cmd.toggle_compose",
616
+ "%cmd.toggle_compose_desc",
615
617
  "markdownToggleCompose",
616
618
  "normal"
617
619
  );
618
620
 
619
621
  editor.registerCommand(
620
- "Markdown: Set Compose Width",
621
- "Set the width for compose mode wrapping and margins",
622
+ "%cmd.set_compose_width",
623
+ "%cmd.set_compose_width_desc",
622
624
  "markdownSetComposeWidth",
623
625
  "normal"
624
626
  );
625
627
 
626
628
  // Initialization
627
629
  editor.debug("Markdown Compose plugin loaded - use 'Markdown: Toggle Compose' command");
628
- editor.setStatus("Markdown plugin ready");
630
+ editor.setStatus(editor.t("status.plugin_ready"));