Skip to content

Consider using a default editor for the ViEditVisually function and / or issue a warning if the $env:VISUAL / $env:EDITOR value is invalid. #4004

Open
@mklement0

Description

@mklement0

Prerequisites

  • Write a descriptive title.

Description of the new feature/enhancement

Currently, invoking the ViEditVisually function fails with no feedback other than a beep:

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 what git does, though on some platforms it has gedit 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 and vim are present (but not in $env:PATH), via $env:ProgramFiles\Git\usr\bin\nano.exe and $env:ProgramFiles\Git\usr\bin\vim.exe
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementIt's a feature request.Needs-Triage 🔍It's a new issue that core contributor team needs to triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions