Closed Herjar closed 3 years ago
Let me know if these work for you. Works in my Ubuntu VM but it'd be nice to get that WSL2 confirmation before I add them to the README. h/t https://github.com/olets/zsh-abbr/issues/20 for getting me started
# in .zshrc
typeset -A ZSH_HIGHLIGHT_REGEXP
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main regexp)
# the next two lines must come after zsh-abbr
ZSH_HIGHLIGHT_REGEXP=('^[[:blank:][:space:]]*('${(j:|:)${(k)ABBR_REGULAR_USER_ABBREVIATIONS}}')$' fg=blue)
ZSH_HIGHLIGHT_REGEXP+=('\<('${(j:|:)${(k)ABBR_GLOBAL_USER_ABBREVIATIONS}}')$' fg=yellow)
% abbr x=test
% abbr -g y=test
% x # should be blue
% <space>x # should be blue
% <tab>x # should be blue
% x; # should not color
% a x # should not color
%
x # should be blue (alt-enter for a line break)
% a
x # should not color
% y # should be yellow
% <space>y # should be yellow
% <tab>y # should be yellow
% y; # should not color
% a y # should be yellow
%
y # should be yellow (alt-enter for a line break)
% a
y # should be yellow
You can customize the fg=
bits to meet your needs
It works great :rocket:
Thank you!
This is now in the README!
When I use an alias, e.g.
alias gst="git status"
, zsh-syntax-highlighting shows if it is a valid command/alias like this:When I define the same with
zsh-abbr
it looks invalid:Is it possible to get the same validation with
zsh-abbr
?