kelleyma49 / PSFzf

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

Setting `EDITOR` does nothing: Can't define any other editor #246

Closed redactedscribe closed 5 months ago

redactedscribe commented 5 months ago

Setting EDITOR to $Env:EDITOR = 'codium --goto ":0"' and running Invoke-FuzzyEdit outputs Executing ''....

No matter what EDITOR is set to, the output is always blank as shown above.

Not setting EDITOR the output is Executing 'code --goto "C:\{snip}.txt:0"'... but this is no use to me as I do no use VS Code but VSCodium.

Thanks.

PSFzf 2.5.19 fzf 0.46.0 PowerShell v7.4.1

kelleyma49 commented 5 months ago

I can see in the code where it's broken! I will try to fix it in the next couple of days

redactedscribe commented 5 months ago

Thanks for the fix @kelleyma49. The variable can now be set. However I have an issue:

Unset:

Executing 'code --goto "D:\Dev\New Text Document.txt:0"'...

After setting env variables:

$Env:EDITOR = 'codium --goto ":0"'
$Env:PSFZF_EDITOR_OPTIONS = 'test'

('code --goto ":0"' was the default before the latest update so I just changed it to codium.)

You can see that the file path comes last, unlike when EDITOR is unset (above):

Executing 'codium --goto ":0" test "D:\Dev\New Text Document.txt"'...`
# Error:
Arguments in `--goto` mode should be in the format of `FILE(:LINE(:CHARACTER))`.

I'm not sure how to set EDITOR to get the following output (using PSFZF_EDITOR_OPTIONS as seen above wouldn't help as it come before the file path):

Executing 'codium --goto "D:\Dev\New Text Document.txt:0"'...` 

Is there some file path variable for PSFzf that I can use between --goto and ":0"?

Thanks.

kelleyma49 commented 5 months ago

@redactedscribe , I've added support for detecting codium so you don't have to set editor options. See #248

redactedscribe commented 5 months ago

Thanks @kelleyma49! I'll report back if it works for me.