PSFzf
PSFzf copied to clipboard
Unable to use Invoke-FuzzyEdit to edit file with CLI text editor
I am now using Powershell 7.4.0.
I set the environment variable of editor
to "nano" with $env:editor = "nano"
When I tried to use Invoke-FuzzyEdit
/ by using the alias fe
, not only that I cannot use nano to edit the file, but it also turn my terminal behave weird (shown as the following gif)
This also happen if i modify the PSFzf.psm1 file to allow using another command-line text editor "micro" for the editor launch option for Invoke-FuzzyEdit
*gif that showing the above weird behavior
Furthermore, if the selected directory path from Invoke-FuzzyEdit contains spacing, the editor cannot open it successfully because of it.
I guess the issue caused by path with spacing can be fixed by adding double quote to the path in Get-EditorLaunch()
function Get-EditorLaunch() {
...
elseif ($editor -eq 'nano') {
...
else {
"$editor$editorOptions +{1} ""{0}""" -f $(Resolve-Path $FileList.Trim('"')), $LineNum #<----- this line
}
}
I couldn't recreate the rendering issues you're seeing, but it might be a race condition where fzf hasn't been killed.
I do have a fix for the path with spaces issue (#243)
For more information, I am using Powershell 7.4.1 (just upgraded few days ago) + Windows Terminal 1.18.3181.0 + fzf 0.45.0 + nano 7.2-1 (from msys2) + PSReadLine 2.3.4 . I also tried to disable other unnecessary module from Powershell and with a blank pwsh profile, such rendering issue still exist.