feat(edit): multi-editor launcher with GUI/terminal fallbacks #59
Reference in New Issue
Block a user
Delete Branch "feat-edit-multi-editor-launcher"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Rewrites
functions/edit.fish(previously a thin nvim wrapper) into a flexible launcher that picks a GUI or terminal editor, resolves rich fallback chains, and can open the clipboard or a literal string as throwaway files. Drives both interactive CLI use (edit notes.txt, abbreviatede) and desktop shortcuts (edit --clipboard --visual).Behavior
--visual/--terminalforce GUI/terminal; with neither, mode auto-detects — interactive tty → terminal ($EDITOR), detached (e.g..desktoplaunch) → GUI ($VISUAL).zed → antigravity-ide → code → kate → kwrite → gnome-text-editor → geditnvim → vim → micro → nano → vi--editor=Xoverrides resolution with a specific binary.--clipboardreuses the existingpfunction (p > tmpfile);--text=STRwrites a literal string to a temp file. Both are additive with positional files.--newmaps to per-editor new-window flags (kate/kwrite--new, code/codium/zed-n, gnome-text-editor--new-window); ignored where unsupported (best-effort).--verboseprints the launch command and lets editor output through;--silentsuppresses everything. The two, and--visual/--terminal, are mutually exclusive (clear errors).&; disown, output to/dev/null); terminal editors run in the foreground.Opinionated guard (C1)
Gated in-body via
__fish_config_op_enabled __fish_config_op_aliases(live toggle). When C1 is disabled it falls back to the legacy bare-editor behavior ($EDITOR→ nvim → nano → vi), so it stays a drop-in for the oldedit.Docs
docs/fish-config.md: rewrote theeditfunction entry and added aneditrow to the C1 Component Reference table.README.md+ AGENTS C1 shadow list: addededit→multi-editor launcher.docs/fish-config.1,docs/html/,docs/wiki/) regenerate via the Gitea Actions man-page/docs workflow on merge tomain.Notes
/tmp— GUI editors are detached, so they can't be safely removed mid-edit.edtalias added: the existingabbr -a e editalready provides a short name and now points at the new launcher.Manual Verification
edit notes.txtin an interactive terminal opens it in the terminal editor ($EDITOR/nvim).edit --visual notes.txtopens it in the GUI editor (kate/zed/etc.).edit --editor=code README.mdopens in VS Code specifically.edit --clipboardopens current clipboard contents as a temp file.edit --text="hello world"opens a temp file containinghello world.edit --terminal --new todo.mdopens a new window/instance where supported.edit --visual --terminalandedit -v -seach error out with a clear message and exit 1.edit -e nonexistent-binary fileerrors with "editor not found" and exit 1.edit -hshows colored help on stdout.set -U __fish_config_op_aliases off,edit filefalls back to the bare editor (no GUI/clipboard frills); re-enabling restores the launcher live.