@brimveyn/aimux-config 0.5.9 → 0.5.10
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/package.json +1 -1
- package/src/actions.ts +6 -0
- package/src/defaults.ts +1 -0
- package/src/external-editor-runtime.ts +78 -0
- package/src/index.ts +7 -0
- package/src/resolver.ts +1 -0
- package/src/types.ts +26 -0
package/package.json
CHANGED
package/src/actions.ts
CHANGED
|
@@ -635,6 +635,12 @@ export const gitPush: ActionFn = (ctx: ModeContext) => {
|
|
|
635
635
|
return r(clearPendingDelete(ctx), [{ type: 'git-push' }])
|
|
636
636
|
}
|
|
637
637
|
|
|
638
|
+
export const openSelectedGitFileInEditor: ActionFn = (ctx: ModeContext) => {
|
|
639
|
+
const file = selectedGitFile(ctx)
|
|
640
|
+
if (!file) return r([])
|
|
641
|
+
return r([], [{ path: file.path, type: 'open-file-in-editor' }])
|
|
642
|
+
}
|
|
643
|
+
|
|
638
644
|
// ---------------------------------------------------------------------------
|
|
639
645
|
// Modal: git-commit
|
|
640
646
|
// ---------------------------------------------------------------------------
|
package/src/defaults.ts
CHANGED
|
@@ -102,6 +102,7 @@ export function getDefaultKeymapConfig(): ResolvedKeymapConfig {
|
|
|
102
102
|
.map('d', actions.gitDestructiveSelected, 'Unstage/delete')
|
|
103
103
|
.map('D', actions.gitUnstageAll, 'Unstage all')
|
|
104
104
|
.map('e', actions.gitToggleFoldAll, 'Expand/collapse all folds')
|
|
105
|
+
.map('o', actions.openSelectedGitFileInEditor, 'Open in editor')
|
|
105
106
|
.map('c', actions.gitCommitOpen, 'Commit')
|
|
106
107
|
.map('p', actions.gitPush, 'Push')
|
|
107
108
|
.map('v', actions.toggleGitDiffView, 'Toggle split/stacked')
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ExternalEditorConfig } from './types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Holds the resolved external-editor config so side effects (which run outside
|
|
5
|
+
* React) can read it synchronously. Set once at startup by the app.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
let current: ExternalEditorConfig = {}
|
|
9
|
+
|
|
10
|
+
export function setExternalEditorConfig(value: ExternalEditorConfig): void {
|
|
11
|
+
current = value
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getExternalEditorConfig(): ExternalEditorConfig {
|
|
15
|
+
return current
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Editors known to be GUI — spawned detached so they don't claim aimux's TTY. */
|
|
19
|
+
export const KNOWN_GUI_EDITORS: ReadonlySet<string> = new Set([
|
|
20
|
+
'appcode',
|
|
21
|
+
'atom',
|
|
22
|
+
'clion',
|
|
23
|
+
'code',
|
|
24
|
+
'code-insiders',
|
|
25
|
+
'codium',
|
|
26
|
+
'cursor',
|
|
27
|
+
'datagrip',
|
|
28
|
+
'fleet',
|
|
29
|
+
'gedit',
|
|
30
|
+
'goland',
|
|
31
|
+
'gvim',
|
|
32
|
+
'idea',
|
|
33
|
+
'kate',
|
|
34
|
+
'macvim',
|
|
35
|
+
'mate',
|
|
36
|
+
'mvim',
|
|
37
|
+
'phpstorm',
|
|
38
|
+
'pycharm',
|
|
39
|
+
'rider',
|
|
40
|
+
'rubymine',
|
|
41
|
+
'subl',
|
|
42
|
+
'sublime_text',
|
|
43
|
+
'vscodium',
|
|
44
|
+
'webstorm',
|
|
45
|
+
'windsurf',
|
|
46
|
+
'zed',
|
|
47
|
+
])
|
|
48
|
+
|
|
49
|
+
/** Per-editor default argv with `{file}` / `{line}` placeholders. */
|
|
50
|
+
export const DEFAULT_EDITOR_ARGS: Record<string, string[]> = {
|
|
51
|
+
'clion': ['--line', '{line}', '{file}'],
|
|
52
|
+
'code': ['-g', '{file}:{line}'],
|
|
53
|
+
'code-insiders': ['-g', '{file}:{line}'],
|
|
54
|
+
'codium': ['-g', '{file}:{line}'],
|
|
55
|
+
'cursor': ['-g', '{file}:{line}'],
|
|
56
|
+
'emacs': ['+{line}', '{file}'],
|
|
57
|
+
'fleet': ['{file}:{line}'],
|
|
58
|
+
'goland': ['--line', '{line}', '{file}'],
|
|
59
|
+
'gvim': ['+{line}', '{file}'],
|
|
60
|
+
'helix': ['{file}:{line}'],
|
|
61
|
+
'hx': ['{file}:{line}'],
|
|
62
|
+
'idea': ['--line', '{line}', '{file}'],
|
|
63
|
+
'micro': ['{file}:{line}'],
|
|
64
|
+
'mvim': ['+{line}', '{file}'],
|
|
65
|
+
'nano': ['+{line}', '{file}'],
|
|
66
|
+
'nvim': ['+{line}', '{file}'],
|
|
67
|
+
'phpstorm': ['--line', '{line}', '{file}'],
|
|
68
|
+
'pycharm': ['--line', '{line}', '{file}'],
|
|
69
|
+
'rider': ['--line', '{line}', '{file}'],
|
|
70
|
+
'rubymine': ['--line', '{line}', '{file}'],
|
|
71
|
+
'subl': ['{file}:{line}'],
|
|
72
|
+
'sublime_text': ['{file}:{line}'],
|
|
73
|
+
'vim': ['+{line}', '{file}'],
|
|
74
|
+
'vscodium': ['-g', '{file}:{line}'],
|
|
75
|
+
'webstorm': ['--line', '{line}', '{file}'],
|
|
76
|
+
'windsurf': ['-g', '{file}:{line}'],
|
|
77
|
+
'zed': ['{file}:{line}'],
|
|
78
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,12 @@ export { getDefaultKeymapConfig } from './defaults'
|
|
|
29
29
|
export { resolveConfig } from './resolver'
|
|
30
30
|
export { isAutoCommitEnabled, setAutoCommitEnabled } from './auto-commit-runtime'
|
|
31
31
|
export { getMultiRepoConfig, setMultiRepoConfig } from './multi-repo-runtime'
|
|
32
|
+
export {
|
|
33
|
+
DEFAULT_EDITOR_ARGS,
|
|
34
|
+
getExternalEditorConfig,
|
|
35
|
+
KNOWN_GUI_EDITORS,
|
|
36
|
+
setExternalEditorConfig,
|
|
37
|
+
} from './external-editor-runtime'
|
|
32
38
|
export { DEFAULT_MULTI_REPO_CONFIG } from './defaults'
|
|
33
39
|
|
|
34
40
|
// User-facing config types (keymap/backends/sessions/etc.).
|
|
@@ -45,6 +51,7 @@ export type {
|
|
|
45
51
|
BackendConfig,
|
|
46
52
|
BindingDef,
|
|
47
53
|
DiscoveredRepo,
|
|
54
|
+
ExternalEditorConfig,
|
|
48
55
|
FocusMode,
|
|
49
56
|
GitFileListMode,
|
|
50
57
|
GitPaneConfig,
|
package/src/resolver.ts
CHANGED
|
@@ -36,6 +36,7 @@ export function resolveConfig(userConfig: AimuxUserConfig): ResolvedConfig {
|
|
|
36
36
|
return {
|
|
37
37
|
autoCommit,
|
|
38
38
|
backends: userConfig.backends ?? {},
|
|
39
|
+
externalEditor: userConfig.externalEditor ?? {},
|
|
39
40
|
gitPane: resolveGitPane(userConfig.gitPane),
|
|
40
41
|
hooks: userConfig.hooks ?? {},
|
|
41
42
|
keymaps,
|
package/src/types.ts
CHANGED
|
@@ -633,6 +633,7 @@ export type SideEffect =
|
|
|
633
633
|
| { type: 'delete-session'; sessionId: string }
|
|
634
634
|
| { type: 'toggle-transparent' }
|
|
635
635
|
| { type: 'toggle-mode' }
|
|
636
|
+
| { type: 'open-file-in-editor'; path: string }
|
|
636
637
|
|
|
637
638
|
// ─── Key input / KeyResult / ModeContext ──────────────────────────────────────
|
|
638
639
|
|
|
@@ -854,6 +855,29 @@ export interface StatusBarConfig {
|
|
|
854
855
|
aiUsage?: AIUsageToolConfig
|
|
855
856
|
}
|
|
856
857
|
|
|
858
|
+
export interface ExternalEditorConfig {
|
|
859
|
+
/** Override `$VISUAL` / `$EDITOR`. */
|
|
860
|
+
command?: string
|
|
861
|
+
/**
|
|
862
|
+
* Force GUI (detached spawn — for vscode/cursor/etc.) or TUI (inline shellout
|
|
863
|
+
* that hands the TTY to the editor). Defaults: GUI for editors in a built-in
|
|
864
|
+
* allowlist (`code`, `cursor`, `subl`, JetBrains, …), TUI otherwise.
|
|
865
|
+
*/
|
|
866
|
+
kind?: 'gui' | 'tui'
|
|
867
|
+
/** Argv passed to the editor. Placeholders: `{file}`, `{line}`. Sensible defaults per known editor. */
|
|
868
|
+
args?: string[]
|
|
869
|
+
/**
|
|
870
|
+
* Opt-in escape hatch for TUI editors only: when set, the TUI editor is
|
|
871
|
+
* launched in a new terminal window using this argv template instead of the
|
|
872
|
+
* default inline shellout. Ignored when `kind` resolves to `'gui'` — GUI
|
|
873
|
+
* editors always spawn detached into their own app window.
|
|
874
|
+
*
|
|
875
|
+
* Placeholders: `{cmd}` (shell-quoted `cd <cwd> && <editor> <args>`), `{cwd}`.
|
|
876
|
+
* Example: `['wezterm', 'start', '--cwd', '{cwd}', '--', 'sh', '-c', '{cmd}']`.
|
|
877
|
+
*/
|
|
878
|
+
terminal?: string[]
|
|
879
|
+
}
|
|
880
|
+
|
|
857
881
|
export interface AimuxUserConfig {
|
|
858
882
|
theme?: AimuxThemeConfig
|
|
859
883
|
keymaps?: (k: KeymapBuilderApi) => KeymapBuilderApi
|
|
@@ -866,6 +890,7 @@ export interface AimuxUserConfig {
|
|
|
866
890
|
autoCommit?: Partial<AutoCommitConfig>
|
|
867
891
|
multiRepo?: Partial<MultiRepoConfig>
|
|
868
892
|
statusBar?: StatusBarConfig
|
|
893
|
+
externalEditor?: ExternalEditorConfig
|
|
869
894
|
}
|
|
870
895
|
|
|
871
896
|
// ─── Resolved config (internal) ───────────────────────────────────────────────
|
|
@@ -938,4 +963,5 @@ export interface ResolvedConfig {
|
|
|
938
963
|
autoCommit: AutoCommitConfig
|
|
939
964
|
multiRepo: MultiRepoConfig
|
|
940
965
|
statusBar: StatusBarConfig
|
|
966
|
+
externalEditor: ExternalEditorConfig
|
|
941
967
|
}
|