You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make the ViEditVisually function more flexible by allowing $env:VISUAL / $env:EDITOR to contain an executable name *with options* #3214
Currently $env:VISUAL / $env:EDITOR may only contain an executable name or path, not also options.
However, to make your favorite editor act properly with this feature - a blocking invocation that returns control to the terminal when the window is closed - options may be required.
For instance, VSCode (Visual Studio Code) requires code --new-window --wait <file> ...
Therefore, you must currently create a helper (non-PowerShell) shell script / batch file in order to incorporate the necessary option, which is a lot of ceremony.
To address that, the interpretation of $env:VISUAL / $env:EDITOR could be extended to allow specifying a command line (prefix) as follows:
First, as currently, see if the value as a whole refers to an executable (typically via $env:PATH) and, if so, use that.
If not, see if the first whitespace-separated / double-quoted token refers to an executable, and use that, passing all remaining tokens through as options (arguments).
If not, as currently, beep to indicate that no (valid) editor is configured.
For instance, this would allow users to set $env:VISUAL as follows for VSCode:
$env:VISUAL = 'code --new-window --wait'
Note: Git, which also respects these environment variables, already supports this.
Activity