Fix highlighting for paths completion using Tab #58
@faceleg Could you please merge this one? Or should I provide more clarification for this change?
I'm really happy someone is finally able to help fix this repo up! Thank you :)
Well, I use this plugin daily* and since no one else has fixed it, I have no choice. :) Trio zsh-autosuggestions, zsh-syntax-highlighting and zsh-history-substring-search is “must have” in ZSH.
* Actually I can’t work in a shell effectively without it.
Thanks for this plugin, everyone, and thanks for the plugin suggestions, @jirutka. I've been a mostly vanilla zsh user for years, and just discovered the world of zsh plugins via this HN - Fish shell article.
@ronjouch I used to use Fish Shell and I very quickly got used to its autosuggestion feature, but never to its non-POSIX compatible syntax. This became a real deal breaker for me. Thus I’ve eventually switched to ZSH.
The first advice for you, avoid Oh-My-ZSH (as a “plugin manager”) and Antigen. The first one is a big, unmaintainable and slow de facto monolith. The second one is poorly designed, it slows done startup time of shell noticeably with every plugin you add. If you want a plugin manager, then I can recommend zgen. It’s very simple and without any overhead.
For inspiration, there’s my current .zshrc (only relevant parts):
# Load zgen
ZGEN_DIR=$ZDOTDIR/plugins
source $ZDOTDIR/zgen/zgen.zsh
# Check if there's no init script.
if ! zgen saved; then
echo "Creating a zgen save"
zgen oh-my-zsh
# plugins
zgen load marzocchi/zsh-notify
zgen load zsh-users/zsh-completions src
zgen load jimmijj/zsh-syntax-highlighting
zgen load zsh-users/zsh-history-substring-search
zgen load tarruda/zsh-autosuggestions
# theme
zgen oh-my-zsh themes/robbyrussell
# save all to init script
zgen save
fi
# This file is a slightly modified version of https://github.com/sorin-ionescu/prezto/blob/master/modules/completion/init.zsh
source $ZDOTDIR/completion.zsh
zmodload zsh/terminfo
# Make sure the terminal is in application mode, when zle is active. Only then
# are the values from $terminfo valid. And also activate autosuggestions.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
# Bind UP and DOWN arrow keys to history-substring-search.
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
function zle-line-init () {
printf '%s' "${terminfo[smkx]}"
# Enable autosuggestions automatically
zle autosuggest-start
}
function zle-line-finish () {
printf '%s' "${terminfo[rmkx]}"
}
zle -N zle-line-init
zle -N zle-line-finish
fi@jirutka neat, thanks! Am currently using ohmyzsh, will give zgen a try :) . Same thoughts on fish, I want its awesome autocomplete and overall sexiness but am not ready to lose sh compliance.
I'm going to try zgen, having become entirely sick of my > 3 second shell startup time. Thanks @jirutka
@ronjouch @jirutka I've just switched (see here for my .zshrc) and wanted to say thanks! First time zsh-autosuggestions has worked anywhere close to my expectations, and zgen has blown me away.
Related to #55.