chrisant996 / clink-fzf

Fzf integration for Clink
MIT License
77 stars 10 forks source link

Surrounding results with double-quotes #2

Closed theperiscope closed 2 years ago

theperiscope commented 2 years ago

File names often contain spaces and need to be surrounded by double quotes to be valid. I wanted to contributed my setup as I find it extremely useful when, for example, I type notepad <C-T>

setx FZF_CTRL_T_COMMAND "fd --type file | sed 's/\(.*\)/\"\1\"/g'"
refreshenv
chrisant996 commented 2 years ago

What is setx? What is refreshenv? They don't seem like standard commands in Windows.

Rather than using sed to always add quotes, I've updated fzf.lua to add quotes according to the standard Windows rules about when quotes are needed.

I also removed a leftover debugging line that printed the dir command to the terminal. 😕

theperiscope commented 2 years ago

That's awesome, thank you, I really like the script functionality and use it daily :) the commands were my "workaround" but I thought of creating the issue since the best place for such feature is script itself.

setx is part of Windows and allows to set user- or system-level environment variables, refreshenv is a batch script that comes bundled with Chocolatey package manager -- reloads environment variables from registry without reboot.

nurpax commented 3 months ago

BTW the tip to use "fd" can give a pretty good user experience to use it for FZF_ALT_C_COMMAND. I have a ton of stuff under %userprofile%'\.cache which means that almost all my fzf search will find some garbage from there instead of giving a relevant result from "real" directories under home. By default "fd" masks out .cache but it is also easier to configure than "dir" to skip some directories or files.

"fd" is easy to install on Windows, it's just a "scoop install fd" away.