olets / zsh-abbr

The zsh manager for auto-expanding abbreviations, inspired by fish. ~18,000 clones by ~12,000 unique cloners as of Sept '24, and averaging ~60 Homebrew installs monthly since June 2023
https://zsh-abbr.olets.dev
Other
554 stars 19 forks source link

snippets for zsh-autosuggestions and zsh-syntax-highlighting #20

Closed z0rc closed 4 years ago

z0rc commented 4 years ago

Not really an issue. I noticed you have TODO items about autosuggestions and highlighting. Here are snippets I use to with zsh-autosuggestions and zsh-syntax-highlighting to better work with zsh-abbr. Hopefully they might be useful for you.

Enable regexp highlighter and add pattern that matches abbreviations as 'words' to highlight them as you like.

ZSH_HIGHLIGHT_HIGHLIGHTERS=(main regexp)
# highlight known abbreviations
typeset -A ZSH_HIGHLIGHT_REGEXP
# regexp matches abbreviations only when they standalone word, but not part of other words
ZSH_HIGHLIGHT_REGEXP+=('(^| )('${(j:|:)${(k)ABBR_REGULAR_USER_ABBREVIATIONS}}')($| )' 'fg=blue')

Disable showing autosuggestion after abbreviations. Also I don't think autosuggesting the abbreviations make much sense as they are usually just 2-3 symbols.

# Don't show suggestions after abbreviations
ZSH_AUTOSUGGEST_HISTORY_IGNORE=${(j:|:)${(k)ABBR_REGULAR_USER_ABBREVIATIONS}}
ZSH_AUTOSUGGEST_COMPLETION_IGNORE=${ZSH_AUTOSUGGEST_HISTORY_IGNORE}
olets commented 4 years ago

Thanks for sharing! This is cool stuff. I'll think about how best to draw other people's attention to the snippets. Will leave this open to remind myself

I don't think autosuggesting the abbreviations make much sense as they are usually just 2-3 symbols.

Haha yes definitely :) I mean highlighting for things like abbr add etc, the app command completions.

olets commented 4 months ago

Belatedly recognizing all contributors in https://github.com/olets/zsh-abbr#community and https://zsh-abbr.olets.dev/community/. Would you like to be added @z0rc?

z0rc commented 4 months ago

@olets sure, thanks!

olets commented 4 months ago

@all-contributors please add @z0rc for doc

allcontributors[bot] commented 4 months ago

@olets

I've put up a pull request to add @z0rc! :tada: