rio icon indicating copy to clipboard operation
rio copied to clipboard

adopt POSIX EDITOR environment variable

Open mcandre opened this issue 8 months ago • 4 comments

POSIX has supported a common EDITOR environment variable for configuring the default console text editor for decades. This is the same environment variable used by git and other applications, when deciding which editor to launch.

Propose deprecating the editor TOML section in favor of this parameter.

As an intermediate step, we could apply logic like:

Default the editor command to nano. This tends to be installed by default in even more distributions than vi(m), so rio is more likely to work correctly out of the box on more UNIX distributions.

If a COMSPEC environment variable is defined, then assume a non-UNIX-like Windows environment (as opposed to WLS, Cygwin, MinGW, Minsysgit, Git Bash, Strawberry Perl sh, UNIX VM, UNIX container, etc.) and override the editor command with edit, the longstanding Windows console editor. notepad is an external process whose clunky integration makes rio look unnecessarily bad, begging for a true GUI settings pane.

Check whether an environment variable EDITOR exists. If it does, then override the editor command to that value.

(Deprecated) Check whether an [editor] TOML section exists. If it does, then apply these overrides.

mcandre avatar Apr 04 '25 23:04 mcandre

Hey @mcandre thanks for the issue, if the configuration isn't settled, not found or is empty then will use $EDITOR

raphamorim avatar Apr 05 '25 08:04 raphamorim

But isn't it incredibly likely that vi is found on the path? $EDITOR should be preferred to the default vi.

dpassen avatar Apr 22 '25 22:04 dpassen

nano is more minimalist and installed on even more platforms than vi.

My own preferred editor in terminals is Vi(m). But for portability nano is more ideal.

mcandre avatar Apr 23 '25 00:04 mcandre

Problem of using EDITOR environment variable over rio is that people would like to configure rio config over env variable sometimes.

I think maybe editor should start empty and if the user would like to use this, then would require further configuration. At least on linux, macos and windows is easier to deal with default editors

raphamorim avatar Apr 23 '25 09:04 raphamorim