Open NathanGrenier opened 6 months ago
getting the same error. I'm wondering if the git-for-windows environment needs some adjustment from fzf-tab to work, because these dotfiles work fine on a linux box.
winget install eza-community.eza -i
)Note: I'm trying to use eza, but ls also fails with the same error.
what's the value of $ZSH_NAME
on windows?
just "zsh"
I kinda have the same problem, but it's most likely related to msys2.
If I run this simple command, I have the preview: fzf --preview='less {}'
But if I run with fzf-tab, I have this error:
(it tries to run zsh as if it was in the current dir)
If I fix the path to zsh, I have this new error:
It seems related to path resolution with the temp dir ?
To fix the path, I only added this in -ftb-fzf:
shell_cmd=$(which $ZSH_NAME)
SHELL=$shell_cmd $fzf_command \
I tried your zsh path fix and get the same (new) error as you. I agree there's a second issue with path resolution. $TEMP on Windows (with msys2 or git-for-windows) is /tmp
, but behind the scenes it is actually a Windows path of C:\Users\USERNAME\AppData\Local\Temp
. The Windows path is being called by zsh at some point (asked by fzf?) and the \
are being interpreted as escape characters, so the path becomes invalid.
I did check my temp folder, and a folder is actually being created in the temp folder and populated with files by fzf-tab.
However, the /tmp/fzf-temp-123456789
temp files (from fzf?) aren't created anymore because of the path issue. If I remove the ZSH path fix, the /tmp/fzf-temp-123456789
files get created, but the zsh "file does not exist" error returns.
(the above folder from fzf-tab only gets created properly after the following change in -ftb-fzf. Without it, the folder is "zsh-fzf-tab-" instead of "zsh-fzf-tab-USERNAME")
- local tmp_dir=${TMPPREFIX:-/tmp/zsh}-fzf-tab-$USER
+ local tmp_dir=${TMPPREFIX:-/tmp/zsh}-fzf-tab-$(whoami)
I checked fzf code:
func WriteTemporaryFile(data []string, printSep string) string {
f, err := os.CreateTemp("", "fzf-temp-*")
if err != nil {
// Unable to create temporary file
// FIXME: Should we terminate the program?
return ""
}
🤣
as for msys2, they may rewrite some code during compilation to make it work. For example, git-for-windows only works in MINGW64, they didn't port it to UCRT64 or CLANG64.
I check how fzf was compiled and they didn't do anything special. but still, fzf works fine in other cases.
now... try this on your command line: zsh $(which fzf)
it doesn't work anymore, but I'm not sure if it should work in the first place...
Can confirm that its not working on windows msys2 zsh, works fine for me on linux Although i don't get any error as in the screenshot posted by the OP, previews just don't show up
I can have the preview if I'm using fzf + other app. The problem seems to come from fzf-tab.
my zdotdir. I have a preview with CTRL+T and ALT+C.
I can have the preview if I'm using fzf + other app. The problem seems to come from fzf-tab.
Just curious what is the alternative that you are talking about
the default keybindings are already quite good. I added preview on CTRL+T and ALT+C. You can also autocomplete cd with
cd **<TAB>
. I'm just missing the completion for command line parameters.
I'm using the OMZ plugin, and how I customized it with fd, eza and rg.
Describe your question
Getting a weird error when using the preview feature in zsh. Not quite sure what to do to resolve it.
This is my .zshrc file:
Screenshot of the Error