-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Q] Error when using fzf-tab's preview feature #444
Comments
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.
Note: I'm trying to use eza, but ls also fails with the same error. .zshrc#!/bin/zsh
#
# .zshrc - Zsh file loaded on interactive shell sessions.
#
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# set zsh options
setopt extended_glob
# clone antidote if necessary
[[ -d ${ZDOTDIR:-~}/.antidote ]] || git clone https://github.com/mattmc3/antidote ${ZDOTDIR:-~}/.antidote # https://github.com/getantidote/antidote is stable
# change antidote home directory - default on windows is %LocalAppData%/antidote
export ANTIDOTE_HOME=${ZDOTDIR:-~}/.antidote_home
# set the name of the static .zsh plugins file antidote will generate
zsh_plugins=${ZDOTDIR:-~}/.antidote.zsh_plugins.zsh
# ensure you have a $zsh_plugins_list file where you can add plugins
zsh_plugins_list=${zsh_plugins:r}_list.zsh
[[ -f ${zsh_plugins_list} ]] || touch ${zsh_plugins_list}
# source zstyles you might use with antidote
[[ -e ${ZDOTDIR:-~}/.antidote.zstyles.zsh ]] && source ${ZDOTDIR:-~}/.antidote.zstyles.zsh
# lazy-load antidote
fpath+=(${ZDOTDIR:-~}/.antidote)
autoload -Uz $fpath[-1]/antidote
# generate static file in a subshell when $zsh_plugins_list is updated
alias al="antidote bundle <${zsh_plugins_list} >|$zsh_plugins"
if [[ ! $zsh_plugins -nt ${zsh_plugins_list} ]]; then
(al)
fi
# source your static plugins file
source $zsh_plugins
# autoload for prompts - see $zsh_plugins_list for explanation
export ZSH_THEME='powerlevel10k'
autoload -Uz promptinit && promptinit && prompt ${ZSH_THEME}
# to customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# source .profile
[[ ! -f ~/.profile ]] || . ~/.profile .antidote.zsh_plugins_list.zsh#!/bin/zsh
#
# .zsh_plugins.txt - antidote plugins file
#
# copied from https://github.com/getantidote/zdotdir/blob/1a34e6dd3d78862c82ba3babd19bd8c882c77d65/.zsh_plugins.txt
### Overview
#
# The `.zsh_plugins.txt` file is used by antidote to configure Zsh bundles. Bundles are
# just a fancy way of referring to Zsh utilities, frameworks, prompts, or plugins.
# `.zsh_plugins.txt` is used by antidote to generate a static `.zsh_plugins.zsh` file,
# which can then be sourced in your `.zshrc`. You can use this file as a starting point
# for your own config. Strip out instructional comments (ie: lines beginning with a '#')
# and any plugins you don't need, then add what you like and make it yours!
#
# NOTE: Order matters in this file! Some bundles need to be last, and others are
# prerequisites. Read the documentation for the plugins you use to ensure proper
# configuration.
#
###
### Completions
#
# You may want to add some additional completions to Zsh. Completions look in your fpath
# for completion functions, which are functions named with a leading underscore
# (eg: _git). You need to add all supplemental completions to your fpath prior to
# running `compinit` to use completions functionality properly. You will want to find
# a completion plugin that runs `compinit` for you, or you can run it yourself in
# your .zshrc after antidote loads like this:
#
# autoload -Uz compinit && compinit
#
###
# zsh-users/zsh-completions is a popular plugin for adding supplemental completions.
# We combine the `path:` and `kind:fpath` annotations here:
jathek/zsh-completions path:src kind:fpath branch:custom
# With antidote, using Zephyr's completion plugin is recommended. This plugin is meant
# to be run near the TOP of your .zsh_plugins.txt file.
mattmc3/zephyr path:plugins/completion
# Most other compinit plugins should be near the END of .zsh_plugins.txt so that $fpath
# has been fully populated. One such plugin is zsh-utils and its completion subplugin.
# belak/zsh-utils path:completion
### Prompts
#
# You can make certain themes available to the built-in Zsh prompt command using the
# `kind:fpath` annotation. A theme is not active for the prompt until this command is
# run:
#
# autoload -Uz promptinit && promptinit
# prompt ${prompt_name:-pure}
#
# There are two ways to load prompts.
# - Add multiple prompt plugins to your `$fpath` with `kind:fpath` and then later in
# your .zshrc run the Zsh built-in `prompt` to select the theme.
# - Or, just load one prompt like a regular plugin.
#
###
romkatv/powerlevel10k kind:fpath
### Frameworks
#
# Frameworks are a collection of Zsh features, settings, and plugins meant to ease
# Zsh configuration. Unfortunately, all that power can come with serious drawbacks.
# Frameworks can often set more settings or aliases than you need, cluttering your Zsh
# config and slowing things down. Use with caution!
#
# Frameworks are handled in antidote using the `path:location/of/plugin` annotation.
#
###
### Framework: Oh-My-Zsh
#
# Oh-My-Zsh is a very popular Zsh framework. You might choose to use plugins from OMZ
# in your own config. Depending on which plugins you use, you may also need to include
# OMZ's entire "lib" directory. If you do this, be careful - "lib" configures a lot of
# very broad settings. If you are familiar with what you are doing, you may choose to
# only include parts of "lib".
#
# # use all of lib
# ohmyzsh/ohmyzsh path:lib
# # -OR-, only use only the specific files we care about
# ohmyzsh/ohmyzsh path:lib/clipboard.zsh
#
####
ohmyzsh/ohmyzsh path:lib/key-bindings.zsh
# 🌬️ A Zsh framework as nice as a cool summer breeze
mattmc3/zephyr path:plugins/color
mattmc3/zephyr path:plugins/directory
# mattmc3/zephyr path:plugins/editor # use ohmyzsh for ctrl-del
mattmc3/zephyr path:plugins/environment
mattmc3/zephyr path:plugins/history
mattmc3/zephyr path:plugins/utility
mattmc3/zephyr path:plugins/zfunctions
### Regular Plugins
#
# Plugins are the simplest kind of bundles. You can point to a full git URL, or if you
# assume GitHub.com, then you can use the user/repo shorthand.
#
###
# rummik/zsh-tailf
# mattmc3/zman
# zle tweak for emulating `...'==`../..' etc.
yoogottamk/zsh-manydots-magic
# 📎 ZSH plugin that reminds you to use existing aliases for commands you just typed
MichaelAquilina/zsh-you-should-use path:you-should-use.plugin.zsh
# Good-lookin' diffs. Actually… nah… The best-lookin' diffs. 🎉
so-fancy/diff-so-fancy
# Replace zsh's default completion selection menu with fzf!
Aloxaf/fzf-tab
# A ZSH plugin to set the terminal tab title according to current directory or running process. It's based (forked) from Oh-My-ZSH one.
trystan2k/zsh-tab-title
### widget wrapping plugins
# zsh-users/zsh-syntax-highlighting # use zdharma-continuum/fast-syntax-highlighting instead
zdharma-continuum/fast-syntax-highlighting
### Final Plugins
#
# Remember plugin order matters! Put plugins that need run last at the bottom of your
# .zsh_plugins.txt file.
#
###
# These popular core plugins should be loaded at the end
zsh-users/zsh-autosuggestions
zsh-users/zsh-history-substring-search .antidote.zstyles.zsh#!/bin/zsh
#
# .zstyles - Set zstyle settings for plugins that need them.
#
#
# Antidote
#
# friendly plugin directories - no 'https-COLON--SLASH--SLASH-github.com-SLASH-'
zstyle ':antidote:bundle' use-friendly-names 'yes'
# change default zsh_plugins.txt name
zstyle ':antidote:bundle' file ${zsh_plugins_list}
# Aloxaf/fzf-tab
# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
# NOTE: don't use escape sequences here, fzf-tab will ignore them
zstyle ':completion:*:descriptions' format '-- %d --'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# force zsh not to show completion menu, which allows fzf-tab to capture the unambiguous prefix
zstyle ':completion:*' menu no
# preview directory's content with eza when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# switch group using `<` and `>`
zstyle ':fzf-tab:*' switch-group '<' '>' |
what's the value of |
I kinda have the same problem, but it's most likely related to msys2. (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:
|
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: 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 |
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. |
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 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
The text was updated successfully, but these errors were encountered: