feat(edit): replace edit wrapper with multi-editor launcher

Rewrite functions/edit.fish as a flexible launcher supporting GUI and
terminal editors with rich fallback chains, clipboard/text temp files,
new-window flags, and verbose/silent output control.

- --visual/--terminal force mode; default auto-detects via tty
- GUI chain: zed → antigravity-ide → code → kate → kwrite → gnome-text-editor → gedit
- Terminal chain: nvim → vim → micro → nano → vi
- --clipboard reuses the existing p function; --text opens a literal string
- --new maps to per-editor new-window flags (best-effort)
- C1 guard falls back to legacy bare-editor behavior when disabled

Docs: update fish-config.md function entry + C1 table, README and AGENTS C1 shadow lists.
This commit is contained in:
2026-06-19 00:58:40 -04:00
parent 7079319a09
commit ed8de40d46
3 changed files with 217 additions and 16 deletions
+28 -2
View File
@@ -698,10 +698,35 @@ Add -i (interactive confirmation) to destructive commands:
### edit
Synopsis: edit [args...]
Opens files in nvim. Falls back to $EDITOR, nano, vi.
Synopsis: edit [-V|-t] [-e EDITOR] [-c] [-x TEXT] [-n] [-v|-s] [FILE...]
Opens files in a text editor, choosing a terminal or GUI editor and
resolving a rich chain of fallbacks. With no --visual/--terminal flag the
mode is auto-detected: interactive terminals use the terminal editor
($EDITOR), while detached invocations (e.g. desktop shortcuts) use the GUI
editor ($VISUAL). Clipboard contents and literal strings can be opened as
throwaway temp files. Editor output is suppressed unless --verbose.
GUI fallback chain: zed → antigravity-ide → code → kate → kwrite →
gnome-text-editor → gedit
Terminal fallback chain: nvim → vim → micro → nano → vi
Options:
-V, --visual Force the GUI editor ($VISUAL or fallbacks)
-t, --terminal Force the terminal editor ($EDITOR or fallbacks)
-e, --editor=X Use a specific editor binary X
-c, --clipboard Open the clipboard contents (as a temp file)
-x, --text=STR Open STR as the contents of a new temp file
-n, --new Force a new window/instance (best-effort)
-v, --verbose Print the launch command and editor output
-s, --silent Suppress all output, including the editor's
-h, --help Show this help message
edit ~/.config/fish/config.fish
edit --visual notes.txt
edit --terminal --new todo.md
edit --editor=code --clipboard
edit --text="hello world"
### fc
@@ -1632,6 +1657,7 @@ all of these commands.
dir / vdir forced --color=auto system dir / vdir
help config intercepts "help config" → config-help fish builtin help
claude auto-links AGENTS.md as CLAUDE.md before launch command claude
edit multi-editor launcher (GUI/term + fallbacks) $EDITOR/nvim/nano/vi
When C1 is disabled, `rm` uses bare `command rm` with no wrapper — files
are permanently deleted, not trashed. There is no intermediate safety net.