fzf-lua icon indicating copy to clipboard operation
fzf-lua copied to clipboard

Bug: previewer cmd cannot have spaces (windows)

Open FelipeLema opened this issue 7 months ago • 1 comments

RTFM Checklist

  • [x] I have searched exisiting issues / discussions
  • [x] I have read the Wiki including the Advanced section
  • [x] I have read man fzf / I am well versed in shell fzf

Operating system

windows 11

Shell

pwsh

Neovim version (nvim --version)

NVIM v0.11.2

Fzf version (fzf --version)

0.62.0

Output of :lua print(os.getenv('FZF_DEFAULT_OPTS'))

nil

Is the problem reproducible with mini.sh?

  • [ ] My issue is reproducible with mini.sh
  • [ ] My issue IS NOT reproducible with mini.sh
  • [X] I have not tested with mini.sh (not relevant, requires LSP, Windows, etc)

Fzf-lua configuration

require('fzf-lua').setup({
  'telescope',
  { previewers = { bat = { cmd = [[C:\some path with spaces\bin\bat.exe]] } } }
})

Describe the bug / steps to reproduce

preview window will complain that C:\some is not a command; the actual C:\some path with spaces\bin\bat.exe command is not run, but its path is being cut/split into its spaces

FelipeLema avatar Jun 06 '25 15:06 FelipeLema

I don’t have access to my windows VM anymore, can you try this (if the below works I’ll fix it in the code):

require('fzf-lua').setup({
  'telescope',
  { previewers = { bat = { cmd = FzfLua.libuv.shellescape [[C:\some path with spaces\bin\bat.exe]] } } }
})

ibhagwan avatar Jun 06 '25 19:06 ibhagwan

ooh, that works alright. Thanks

closing

FelipeLema avatar Jun 10 '25 01:06 FelipeLema

ooh, that works alright. Thanks

closing

I can add automatic escaping to the previewer code as well.

ibhagwan avatar Jun 10 '25 01:06 ibhagwan

I don't have it with me right now, but I remember some "launch process" function had unsolvable-in-the-near-future problems with spaces (maybe uv.spawn()?)

so I would not add any code if "spaces in command path" is not a problem... yet

FelipeLema avatar Jun 12 '25 18:06 FelipeLema

Alright we can leave it as is for now, if this becomes an issue I can always add automatic escape in the code.

ibhagwan avatar Jun 12 '25 18:06 ibhagwan