kelleyma49 / PSFzf

A PowerShell wrapper around the fuzzy finder fzf
MIT License
750 stars 35 forks source link

$ENV:EDITOR only works for nvim #249

Closed hrai closed 4 months ago

hrai commented 4 months ago

When I set vim as $ENV:EDITOR no editor is opened.

I only get the output below: image

https://github.com/kelleyma49/PSFzf/pull/158

But when I set it to nvim are per this https://github.com/kelleyma49/PSFzf/issues/157, I have similar issue as described here https://github.com/kelleyma49/PSFzf/issues/242: image

The editor is open but I can't trace what's going on in the editor.

hrai commented 4 months ago

Actually I identified the culprit to be -NoNewWindow flag that is a Windows bug.

https://github.com/kelleyma49/PSFzf/blob/f3e0ec83f1a2cf11c9337a1377601af68d816029/PSFzf.Functions.ps1#L136

Here's the command I ran that would give this error behaviour on Windows Terminal. Start-Process nvim -ArgumentList '"C:\_dev\yarn.lock" +0' -NoNewWindow

@kelleyma49 is it possible to add a flag to the FuzzyEdit command to have this -NoNewWindow as optional?

hrai commented 4 months ago

I disabled the keymap and added a workaround instead.

function FindFile
{
  Get-ChildItem . -Recurse -Attributes !Directory | Invoke-Fzf | % { vim $_ }
}
Set-Alias fe FindFile