Open
Description
Prerequisites
- Write a descriptive title.
Description of the new feature/enhancement
Currently, invoking the ViEditVisually
function fails with no feedback other than a beep:
- if neither
$env:VISUAL
no$env:EDITOR
are defined. - If either variable exists, but contains an invalid value (notably including the case where options are part of the value - see Allow for invoking a visual editor to modify the current command PowerShell#21525).
Consider modifying the behavior as follows, which would not only be more user-friendly in general, but also align with the behavior of other utilities, such as bash
and git
:
-
Use a default editor if neither
$env:VISUAL
no$env:EDITOR
are defined - and issue a warning if it cannot be found.- A possible candidate on Unix-like platform is
vi
(this is whatgit
does, though on some platforms it hasgedit
as the compiled-in default) - On Windows, Notepad would do as a guaranteed-to-be-present option, though that would require invocation via
Start-Process -Wait
(or equivalent) to ensure synchronous execution. Note that if a given machine has Git for Windows installed,nano
andvim
are present (but not in$env:PATH
), via$env:ProgramFiles\Git\usr\bin\nano.exe
and$env:ProgramFiles\Git\usr\bin\vim.exe
- A possible candidate on Unix-like platform is
-
Issue a warning if the effective
$env:VISUAL
/$env:EDITOR
value isn't invalid; ditto, should the decision be made not to implement use of a default editor and neither$env:VISUAL
nor$env:EDITOR
is defined.
Proposed technical implementation details (optional)
No response