PSFzf icon indicating copy to clipboard operation
PSFzf copied to clipboard

New CTRL-T behaviour

Open ManuelAF opened this issue 1 year ago • 7 comments

Till version 2.5.22 using ctrl-t the relative path of the selection was sent to the command line, now with the version 2.5.22 the full path (c:\users...) is sent, is there any way to change it ?

ManuelAF avatar Feb 09 '24 13:02 ManuelAF

I can only reproduce this when Set-PsFzfOption -EnableFd is enabled. I'll do like c:\temp ctrl-t

I believe it likely has to do with an alias conflict for this script and the winget sharkdp.fd package, which puts fd.exe in the path, used by neovim telescope plugin.

cprusprus avatar Feb 24 '24 22:02 cprusprus

The only change is upgrading from 2.5.19 to 2.5.22, till this update I do someting like notepad ctrl-t (and select a file) an the path added to the command line is relative, now with the 2.5.22 update, is a full path, but if you do notepad .ctrl-t(and select a file) even with the 2.5.22 version you get a relative path

ManuelAF avatar Feb 24 '24 23:02 ManuelAF

I see what you mean yeah, I get full paths too if I precede with an application like notepad.

cprusprus avatar Feb 24 '24 23:02 cprusprus

I think the new behavior was introduced here #236

https://github.com/kelleyma49/PSFzf/blame/a02741b05390fc69e472048d7008ca145cf4dcc7/PSFzf.Base.ps1#L748

ManuelAF avatar Feb 25 '24 09:02 ManuelAF

Why was it even touching the pre-existing path fragment the user had on the command line before invoking PSFzf? That seems like the wrong algorithm. That portion of the CL should be read-only, Ideally, PSFzf takes it in as a parameter and adjusts results based on it.

IOW that change didn't fix the underlying issue with #236, it simply changed to use full paths as output.

Is there a reason this regression breaks existing workflows (relative vs absolute paths)?

cprusprus avatar Feb 25 '24 16:02 cprusprus

Use fdfind to get the relative path of file.

$env:FZF_CTRL_T_COMMAND="fd --color always"

owenstake avatar Mar 08 '24 11:03 owenstake

I'm already using it

$env:FZF_CTRL_T_COMMAND='fd --hidden --follow --exclude .git --exclude node_modules --exclude .vs --exclude .vscode'

ManuelAF avatar Mar 08 '24 11:03 ManuelAF