zsh-users / zsh-syntax-highlighting

Fish shell like syntax highlighting for Zsh.
github.com/zsh-users/zsh-syntax-highlighting
BSD 3-Clause "New" or "Revised" License
19.5k stars 1.32k forks source link

Prompt color changing before completing #922

Open Silverbullet069 opened 1 year ago

Silverbullet069 commented 1 year ago

After typing the first character: 1

After typing 2nd: 2

Full (without spacebar): 3

Full (with spacebar): 4

typeset ZSH_VERSION=5.8.1 typeset ZSH_PATCHLEVEL=ubuntu/5.8.1-1 typeset ZSH_HIGHLIGHT_REVISION=HEAD typeset ZSH_HIGHLIGHT_VERSION=0.8.0-alpha2-dev

sgoudham commented 1 year ago

Hey, I'm also getting the same issue as described above. I'm running Ubuntu 22.04 with ZSH 5.9.0 using Nix Home Manager.

Were you able to figure out why this happens?

I've listed my configuration down below just in case there are any standard tools/plugins which we both have installed that may be causing this issue.

zsh = {
      enable = true;
      enableAutosuggestions = true;
      enableCompletion = true;
      # I don't know why the highlighting doesn't work properly
      enableSyntaxHighlighting = true;

      envExtra = ''
        export ZVM_INIT_MODE=sourcing
      '';
      initExtra = let
        functionsDir = "${config.home.homeDirectory}/${config.programs.zsh.dotDir}/functions";
      in ''
        for conf in "${functionsDir}"/**/*.zsh; do
          source "$conf"
        done

        # WezTerm
        if [[ "$TERM_PROGRAM" == "WezTerm" ]]; then
          TERM=wezterm
          source $HOME/.config/wezterm/wezterm.sh
        fi

        source <(konf-go shellwrapper zsh)
        source <(konf-go completion zsh)
        # open last konf on new shell session
        konf --silent set -
      '';

      dotDir = ".config/zsh";
      oh-my-zsh = {
        enable = true;
        plugins = [
          "colored-man-pages"
          "colorize"
          "docker"
          "docker-compose"
          "git"
          "kubectl"
        ];
      };
      plugins = let 
          themepkg = pkgs.fetchFromGitHub {
            owner = "catppuccin";
            repo = "zsh-syntax-highlighting";
            rev = "06d519c20798f0ebe275fc3a8101841faaeee8ea";
            sha256 = "sha256-Q7KmwUd9fblprL55W0Sf4g7lRcemnhjh4/v+TacJSfo=";
          };
        in [
        {
          name = "zsh-vi-mode";
          src = pkgs.zsh-vi-mode;
          file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
        }
        {
          name = "zsh-nix-shell";
          src = pkgs.zsh-nix-shell;
          file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
        }
        {
          name = "nix-zsh-completions";
          src = pkgs.nix-zsh-completions;
          file = "share/nix-zsh-completions/nix-zsh-completions.plugin.zsh";
        }
        {
          name = "ctp-zsh-syntax-highlighting";
          src = themepkg;
          file = themepkg + "/themes/catppuccin_mocha-zsh-syntax-highlighting.zsh";
        }
      ];

      history = {
        path = "${config.home.homeDirectory}/${config.programs.zsh.dotDir}/history";
      };
    };
  };