Last active
June 6, 2020 14:35
-
-
Save 3v1n0/63bdec4d9c69cd6c4a483351070bfcdb to your computer and use it in GitHub Desktop.
Broken zsh syntax highlighting when using async zinit (turbo mode) + powerlevel10k and zsh-autosuggestions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typeset -g MY_ZSH_CONFIG_PATH=${ZDOTDIR:-$HOME/.config/zsh} | |
typeset -g MY_ZINIT_PATH=${ZDOTDIR:-$HOME/.local/share}/zinit | |
HISTFILE=$MY_ZSH_CONFIG_PATH/zsh_history | |
if [ ! -f $MY_ZINIT_PATH/bin/zinit.zsh ] && ((${+commands[git]})); then | |
__zinit_just_installed=1 | |
mkdir -p $MY_ZINIT_PATH && chmod g-rwX "$MY_ZINIT_PATH" && \ | |
git clone --depth=1 https://github.com/zdharma/zinit.git $MY_ZINIT_PATH/bin | |
fi | |
if [ -f $MY_ZINIT_PATH/bin/zinit.zsh ]; then | |
declare -A ZINIT | |
ZINIT[HOME_DIR]="$MY_ZINIT_PATH" | |
source $MY_ZINIT_PATH/bin/zinit.zsh | |
if [ -z "$skip_global_compinit" ]; then | |
autoload -Uz _zinit | |
(( ${+_comps} )) && _comps[zinit]=_zinit | |
fi | |
[ -n "$__zinit_just_installed" ] && \ | |
zinit self-update | |
unset MY_ZINIT_PATH # Use ZINIT[HOME_DIR] from now on | |
[ ${${(s:.:)ZSH_VERSION}[1]} -ge 5 ] && [ ${${(s:.:)ZSH_VERSION}[2]} -gt 2 ] && \ | |
MY_ZINIT_USE_TURBO=true | |
fi | |
# mappings for Alt+[shif]+jkhl | |
bindkey "\eh" backward-char | |
bindkey "\el" forward-char | |
bindkey "\eH" backward-word | |
bindkey "\eL" forward-word | |
bindkey "\eb" backward-word | |
bindkey "\ew" forward-word | |
bindkey "\ee" forward-word | |
bindkey "\ek" history-search-backward | |
bindkey "\ej" history-search-forward | |
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true | |
# WORKS IN THIS WAY | |
# zinit wait depth=1 lucid nocd for\ | |
# romkatv/powerlevel10k | |
# Using normal load seems to be the problem | |
zinit depth=1 lucid nocd for \ | |
romkatv/powerlevel10k | |
_my_zsh_custom_plugins=( | |
zsh-users/zsh-autosuggestions | |
zsh-users/zsh-syntax-highlighting | |
zsh-users/zsh-history-substring-search | |
) | |
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=true | |
typeset -g ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) | |
__zinit_plugin_loaded_callback() { | |
if [[ "$ZINIT[CUR_PLUGIN]" == "zsh-autosuggestions" ]]; then | |
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=("${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[@]/forward-char}") | |
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS+=forward-char | |
elif [[ "$ZINIT[CUR_PLUGIN]" == "zsh-history-substring-search" ]]; then | |
bindkey "\ek" history-substring-search-up | |
bindkey "\ej" history-substring-search-down | |
fi | |
} | |
zinit wait lucid depth=1 \ | |
atload='__zinit_plugin_loaded_callback' \ | |
for ${_my_zsh_custom_plugins[@]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment