edit
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 get the terminal editor ($EDITOR), while detached invocations (desktop shortcuts) get 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 → geditTerminal fallback chain: nvim → vim → micro → nano → viArguments:
FILE... |
Files to open (any number) |
-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, where supported) |
-v, --verbose |
Print the launch command and let editor output through |
-s, --silent |
Suppress all output, including the editor’s |
-h, --help |
Show this help message |
Returns:
0 |
Editor launched successfully |
1 |
Conflicting flags, no editor found, or clipboard read failed |
edit notes.txtedit --visual ~/.config/fish/config.fishedit --terminal --new todo.mdedit --editor=code --clipboardedit --text="hello world"