Skip to content
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

[BUG] Idk if its exactly a bug but there is a weird bug with color indicators #234

Closed
5 tasks done
yavko opened this issue Oct 17, 2021 · 46 comments
Closed
5 tasks done
Labels
bug Something isn't working

Comments

@yavko
Copy link

yavko commented Oct 17, 2021

Describe the bug

A clear and concise description of what the bug is.

I can make sure:

  • I am using the latest version of fzf-tab
  • this is the minimal zshrc which can reproduce this bug
  • fzf-tab is loaded after compinit
  • fzf-tab is loaded after plugins which will wrap Tab, like junegunn/fzf/completion.zsh
  • fzf-tab is loaded before zsh-autosuggestions, zsh-syntax-highlighting and fast-syntax-highlighting.

To Reproduce

Steps to reproduce the behavior:

  1. type cat in this example
  2. weird bug

Expected behavior

CleanShot 2021-10-16 at 21 02 28@2x

not having those things around the text

Screenshots

CleanShot 2021-10-16 at 21 03 12@2x

Environment:

  • OS: macOS
  • zsh version: 5.8
  • term: kitty
  • prompt: powerlevel10k
  • framework: zim

Minimal zshrc

#### FIG ENV VARIABLES ####
# [ -s ~/.fig/shell/pre.sh ] && source ~/.fig/shell/pre.sh
#### END FIG ENV VARIABLES ####
# 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

# Start configuration added by Zim install {{{
#
# User configuration sourced by interactive shells
#

# -----------------
# Zsh configuration
# -----------------

#
# History
#

# Remove older command from the history if a duplicate is to be added.
setopt HIST_IGNORE_ALL_DUPS

#
# Input/output
#

# Set editor default keymap to emacs (`-e`) or vi (`-v`)
bindkey -e

# Prompt for spelling correction of commands.
#setopt CORRECT

# Customize spelling correction prompt.
#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '

# Remove path separator from WORDCHARS.
WORDCHARS=${WORDCHARS//[\/]}


# --------------------
# Module configuration
# --------------------

#
# completion
#

# Set a custom path for the completion dump file.
# If none is provided, the default ${ZDOTDIR:-${HOME}}/.zcompdump is used.
#zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}"

#
# git
#

# Set a custom prefix for the generated aliases. The default prefix is 'G'.
#zstyle ':zim:git' aliases-prefix 'g'

#
# input
#

# Append `../` to your input for each `.` you type after an initial `..`
#zstyle ':zim:input' double-dot-expand yes

#
# zsh-autosuggestions
#

#
# termtitle
#

function termtitlepwd() {
setopt LOCAL_OPTIONS EXTENDED_GLOB
local git_root current_dir separator
local -i dir_length
if zstyle -t ':zim:prompt-pwd' git-root && \
    git_root=$(command git rev-parse --show-toplevel 2>/dev/null); then
  current_dir="${PWD#${git_root:h}/}"
else
  current_dir=${(%):-%~}
fi
zstyle -s ':zim:prompt-pwd:separator' format 'separator' || separator='/'
zstyle -s ':zim:prompt-pwd:fish-style' dir-length 'dir_length' || dir_length=0
if [[ ${dir_length} -gt 0 || ${separator} != '/' ]]; then
  local current_dirs=("${(@s:/:)current_dir}")
  if (( dir_length > 0 && ${#current_dirs} > 2 )); then
    current_dirs[2,-2]=("${(@M)current_dirs[2,-2]##.#?(#c,${dir_length})}")
  fi
  separator=${(e)separator}
  current_dir="${(@pj:$separator:)current_dirs}"
fi
print -Rn ${current_dir}
}

# Set a custom terminal title format using prompt expansion escape sequences.
# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
# If none is provided, the default '%n@%m: %~' is used.
zstyle ':zim:prompt-pwd:fish-style' dir-length 1
zstyle ':zim:termtitle' format 'zsh %~' 

# Customize the style that the suggestions are shown with.
# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242'
#
# zsh-syntax-highlighting
#

# Set what highlighters will be used.
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)

# Customize the main highlighter styles.
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
#typeset -A ZSH_HIGHLIGHT_STYLES
#ZSH_HIGHLIGHT_STYLES[comment]='fg=242'

# ------------------
# Initialize modules
# ------------------

if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
  # Update static initialization script if it does not exist or it's outdated, before sourcing it
  source ${ZIM_HOME}/zimfw.zsh init -q
fi
source ${ZIM_HOME}/init.zsh



# ------------------------------
# Post-init module configuration
# ------------------------------

#
# zsh-history-substring-search
#

# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down

# Bind up and down keys
zmodload -F zsh/terminfo +p:terminfo
if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
  bindkey ${terminfo[kcuu1]} history-substring-search-up
  bindkey ${terminfo[kcud1]} history-substring-search-down
fi

bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# }}} End configuration added by Zim install

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
(( ! ${+functions[p10k]} )) || p10k finalize

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

#### Yavkos stuff ####

export VULTR_API_KEY='xxxx'
export PATH=~/.npm-global/bin:$PATH
export PATH=~/go/bin:$PATH
export PATH=~/yavkocli:$PATH
export PATH=~/.cargo/bin:$PATH
export PATH="/Users/yavor/.deno/bin:$PATH"
export PATH="/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.2.0/Contents/Home/bin:$PATH"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.2.0/Contents/Home
export PATH="/Applications/Xcode.app/Contents/Developer/usr/bin/safari-web-extension-converter:$PATH"
alias rm=trash
alias vscode="code-insiders ."
alias ls="exa --icons"
alias cat=bat
alias pip=pip3
export PATH="/Users/yavor/yavkocli/jadx-1.2.0.82-fork1/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH="/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers:$PATH"
export VISUAL=nano
export EDITOR=nano
export Visual=nano
export Editor=nano
export visual=nano
export editor=nano
alias icat="kitty +kitten icat"

#### Yavkos stuff end ####

#### Yavkos Funcs ####
export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
function show_hex() {
    perl -e 'foreach $a(@ARGV){print "\e[48:2::".join(":",unpack("C*",pack("H*",$a)))."m \e[49m "};print "\n"' "$@"
}

#### Yavkos Funcs ####

## fzf dracula ##
export FZF_DEFAULT_OPTS='--border rounded --ansi --color=fg:#f8f8f2,bg:#282a36,hl:#bd93f9 --color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9 --color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6 --color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4'
zstyle ':completion:*:git-checkout:*' sort false
zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':fzf-tab:complete:*:*' fzf-preview 'less ${(Q)realpath}'
export LESSOPEN='|~/.lessfilter %s'
zstyle ':fzf-tab:*' switch-group ',' '.'
zstyle ':fzf-tab:*' fzf-command fzf
## fzf dracula end ##

#### FNM ENV VARIABLES ####
eval "$(fnm env)"
#### END FNM ENV VARIABLES ####


#### FIG ENV VARIABLES ####
# [ -s ~/.fig/fig.sh ] && source ~/.fig/fig.sh
#### END FIG ENV VARIABLES ####

# bpm #
 export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/bpm/source/pkg/bin:$PATH"
 eval "$(bpm init zsh)"
# bpm #

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

zimrc:

# Start configuration added by Zim install {{{
# -------
# Modules
# -------

zmodule prompt-pwd
zmodule Aloxaf/fzf-tab

# Sets sane Zsh built-in environment options.
zmodule environment
# Provides handy git aliases and functions.
zmodule git
# Applies correct bindkeys for input events.
zmodule input
# Sets a custom terminal title.
zmodule termtitle
# Utility aliases and functions. Adds colour to ls, grep and less.
zmodule utility

zmodule romkatv/powerlevel10k
zmodule fzf
zmodule exa
zmodule zsh-users/zsh-completions
zmodule hadenlabs/zsh-kitty
#
# Prompt
#
# Exposes git repository status information to prompts.
zmodule git-info
# A heavily reduced, ASCII-only version of the Spaceship and Starship prompts.
zmodule asciiship

# Additional completion definitions for Zsh.
zmodule zsh-users/zsh-completions
# Enables and configures smart and extensive tab completion.
# completion must be sourced after zsh-users/zsh-completions
zmodule completion
# Fish-like autosuggestions for Zsh.
zmodule zsh-users/zsh-autosuggestions
# Fish-like syntax highlighting for Zsh.
# zsh-users/zsh-syntax-highlighting must be sourced after completion
zmodule zdharma/fast-syntax-highlighting
# Fish-like history search (up arrow) for Zsh.
# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting
zmodule zsh-users/zsh-history-substring-search
# }}} End configuration added by Zim install
@yavko yavko added the bug Something isn't working label Oct 17, 2021
@Aloxaf
Copy link
Owner

Aloxaf commented Oct 22, 2021

See #24

TLDR: add zstyle ':completion:*:descriptions' format '[%d]' to your zshrc

@Aloxaf Aloxaf closed this as completed Oct 22, 2021
@yavko
Copy link
Author

yavko commented Oct 22, 2021

thx

@yavko
Copy link
Author

yavko commented Oct 23, 2021

@Aloxaf Didn't fix...

@yavko
Copy link
Author

yavko commented Oct 23, 2021

plus i already had that in my zshrc

@Aloxaf
Copy link
Owner

Aloxaf commented Oct 23, 2021

@yavko Put it to the end of zshrc, so that it won't be overridden by other plugins.

@yavko
Copy link
Author

yavko commented Oct 23, 2021

kk

@yavko
Copy link
Author

yavko commented Oct 28, 2021

@Aloxaf forgot to say its a very bottom and it still doesnt work!

@Aloxaf
Copy link
Owner

Aloxaf commented Oct 29, 2021

That's strange. Does it work in an interactive session?

@Aloxaf Aloxaf reopened this Oct 29, 2021
@yavko
Copy link
Author

yavko commented Oct 29, 2021

nope

@Aloxaf
Copy link
Owner

Aloxaf commented Oct 30, 2021

Can you provide the output of
zstyle -s ':completion:*:descriptions' format reply; echo $reply
and
cat $functions_source[_bat] ?

@yavko
Copy link
Author

yavko commented Oct 30, 2021

the first thing returns
[%d]
But the second thing never finishes it just stays blank and never does anything I have to kill it by my self.

@brerx
Copy link

brerx commented Nov 10, 2021

the first thing returns
[%d]
But the second thing never finishes it just stays blank and never does anything I have to kill it by my self.

same output for me ☹️

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 12, 2021

@yavko @brerx Does this bug only happen with cat or with every commands?

@yavko
Copy link
Author

yavko commented Nov 12, 2021

It happens with cat, and other commands as well
Btw I made this bug report on my old pc it still happens on this fresh Manjaro linux install.

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 12, 2021

@yavko Can you trigger the completion with C-x ., and then provide the log here?

@yavko
Copy link
Author

yavko commented Nov 12, 2021

How?
image

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 12, 2021

@yavko Enter cat , and then press Ctrl-x .

@yavko
Copy link
Author

yavko commented Nov 12, 2021

oh

@yavko
Copy link
Author

yavko commented Nov 12, 2021

image

@yavko
Copy link
Author

yavko commented Nov 12, 2021

using bat btw

@brerx
Copy link

brerx commented Nov 12, 2021

Enter cat , and then press Ctrl-x .

It does not come back for me. Pressing Ctrl-c twice tells me that something has been written to a log file.

Content of that:

+fzf-tab-debug:9> : zsh 5.8
+fzf-tab-debug:10> zle .fzf-tab-orig-expand-or-complete-with-indicator
�[J�[6n
�[G
�[G
�[G
�[G
�[G
�[G
�[G
�[G
�[G
�[G
�[G
�[G
�[G�[13A�[G�[K
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[1B
�[;m                                                                                                      
�[13A
�[;m                                                                                                      
�[;1;38;5;110m>�[m�[;m �[m�[;1m�[m�[;1m�[m�[1B
�[;m                                                                                                      
�[;1;38;5;148m⠋�[m
�[2C�[;38;5;144m0/0 (0)�[m�[1A
�[2C�[2B
�[;1;38;5;161;48;5;236m>�[m�[;48;5;236m �[m�[;1;38;5;254;48;5;236m�[m�[;1;37;48;5;236mBrewfile�[m�[1B
�[;48;5;236m �[m�[;m �[;m�[m�[;37mBrewfile.lock.json�[m�[1B
�[;m                                                                                                      

�[2C�[;38;5;144m12/12 (0)�[m�[1A
�[2C
�[2C
�[J+fzf-tab-debug:11> unsetopt xtrace

For vim, the last parts seem to be hidden:
image

@brerx
Copy link

brerx commented Nov 12, 2021

Might the unsetopt xtrace at the end mean something?

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 12, 2021

@yavko There should be a log file after completion. Please upload it.

图片

@brerx It seems that fzf-tab is not the last plugin to wrap Tab (except zsh-autosuggestions, zsh-syntax-highlighting). Please provide your zshrc.

@yavko
Copy link
Author

yavko commented Nov 12, 2021

@yavko There should be a log file after completion. Please upload it.

图片

@brerx It seems that fzf-tab is not the last plugin to wrap Tab (except zsh-autosuggestions, zsh-syntax-highlighting). Please provide your zshrc.

ok

@yavko
Copy link
Author

yavko commented Nov 12, 2021

I don't see that, im pressing ctrl+x . no logs

@brerx
Copy link

brerx commented Nov 12, 2021

I'm using prezto,

leaving out aliases and stuff, that's the most important parts of zshrc:

...
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit promptinit colors edit-command-line vcs-info
colors
compinit -i
promptinit
zle -N edit-command-line
...
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
...

and in the zpreztorc i have

...
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'ssh' \
  'completion' \
  'homebrew' \
  'osx' \
  'ruby' \
  'rails' \
  'git' \
  'syntax-highlighting' \
  'history-substring-search' \
  'contrib-prompt' \
  'prompt' \
  'fzf-tab'
 ...

Now that you say so, I don't really know in what order these two are loaded, but maybe just the module order is important?

@yavko
Copy link
Author

yavko commented Nov 12, 2021

I use zimfw and have fzf-tab installed through aur and symlinked into the modules folder and have it loaded first in .zimrc so idk

@yavko
Copy link
Author

yavko commented Nov 12, 2021

Wait maybe i should switch the loading sequence

@yavko
Copy link
Author

yavko commented Nov 12, 2021

didnt work

@nemotiger
Copy link

I also have this problem, and I fixed it by removing this line: zstyle ':completion:*' format ' %F{yellow}-- %d --%f'
Both prezto and zimfw have this setting.

@yavko
Copy link
Author

yavko commented Nov 29, 2021

Thanks!
edit: I cant find it in my zshrc

@nemotiger
Copy link

I see that you are using Zim. It is line 37 of this file.

@yavko
Copy link
Author

yavko commented Nov 29, 2021

I commented it out nothing changes

@nemotiger
Copy link

You might need to remove some *.zwc files to make it work. Note that I have never used Zim and I'm just guessing.
This type of issues are the main reason why I no longer use any configuration framework.

@yavko
Copy link
Author

yavko commented Nov 29, 2021

ok!

@nemotiger
Copy link

@Aloxaf Can my ad hoc solution help you fix the bug?

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 30, 2021

@nemotiger Oh thanks, that helps a lot.

@yavko How about add zstyle ':completion:*:descriptions' format '[%d]' to the end of zshrc and then clear cache? It should be able to overwrite the framework's configuration.

@yavko
Copy link
Author

yavko commented Nov 30, 2021

How do I clear cache?

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 30, 2021

@yavko just remove the *.zwc

@yavko
Copy link
Author

yavko commented Nov 30, 2021

k

@yavko
Copy link
Author

yavko commented Nov 30, 2021

Ok it still doesn't work i cleared all cache

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 30, 2021

@yavko add these lines to your zshrc

zstyle -d ':completion:*' format
zstyle ':completion:*:descriptions' format '[%d]'

@yavko
Copy link
Author

yavko commented Nov 30, 2021

@yavko add these lines to your zshrc

zstyle -d ':completion:*' format
zstyle ':completion:*:descriptions' format '[%d]'

ok

@yavko
Copy link
Author

yavko commented Nov 30, 2021

IT WORKS!
image

@Aloxaf
Copy link
Owner

Aloxaf commented Nov 30, 2021

Good, I will update the pinned issue.

@Aloxaf Aloxaf closed this as completed Nov 30, 2021
@yavko
Copy link
Author

yavko commented Nov 30, 2021

Finally!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants