Potential for integration with PSReadLine's `ViEditVisually` function
I think Show-PSEditor has great potential for integration with PSReadLine's ViEditVisually function; the latter allows invocation of an editor as a richer alternative to direct command-line editing, and Show-PSEditor's features make it ideally suited to that.
However, for this to be possible:
-
PSReadLine would have to be enhanced to allow specifying a PowerShell command via
$env:VISUALor$env:EDITOR- currently, only an external program may be specified. -
Show-PSEditor's current behavior too could be enhanced to support that:- Notably, addressing #52 would help (as well as #50).
- Ideally, there'd also be a way to pass the startup cursor position, so as to place the cursor in the editor buffer in the same position it was in the command-line buffer, as supported by
codeandmicro, for instance (expressed in terms of the target line and column number).- That said, PSReadLine would either have to be enhanced to somehow communicate this position to the
ViEditVisuallyfunction; however, a custom implementation of said function can enable such functionality already (see below).
- That said, PSReadLine would either have to be enhanced to somehow communicate this position to the
See https://github.com/PowerShell/PowerShell/issues/21525#issuecomment-2078215370 for a proof-of-concept that allows you to set $env:VISUAL or $env:EDITOR to 'psedit' or 'Show-PSEditor' to experiment with what such an integration could look like.