zdharma-continuum / fast-syntax-highlighting

Feature-rich syntax highlighting for ZSH
BSD 3-Clause "New" or "Revised" License
1.06k stars 76 forks source link

[feat]: Make fast-theme be silent by default and do nothing if theme already set #44

Open dagadbm opened 1 year ago

dagadbm commented 1 year ago

If the feature request is for a plugin or theme, specify it here.

No response

If the feature solves a problem you have, specify it here.

No response

Describe the proposed feature.

I would like to use fast-theme to set the theme as part of a CLI script (that can be run several times) however, it is very noisy the output and there is no option to silence it.

Also if theme is already set nothing should be done on this script as well.

Describe alternatives you've considered

No response

Additional context

No response

Related Issues

No response

9ary commented 1 year ago

This would also be useful for declarative theme configuration, as it would be practical to call fast-theme from zshrc.

Edit: this snippet does exactly what I want, but it depends on the plugin itself being loaded:

function () {
    local theme=$1
    local current_theme
    zstyle -g current_theme ':plugin:fast-syntax-highlighting' theme
    if [[ $current_theme != $theme ]]; then
        fast-theme $theme
    fi
} base16