Skip to content

recommended pattern for binding my own function to zle-line-pre-redraw while supporting z-sy-h #974

@olets

Description

@olets

I want to bind a function of my own to zle-line-pre-redraw.

Doing this naively effectively disables z-sy-h

# load z-sy-h

my_fn() {
  # my functionality
}

zle -N zle-line-pre-redraw my_fn

I've found that, as you know, calling _zsh_highlight__zle-line-pre-redraw from my function lets me add my functionality alongside z-sy-h

# load z-sy-h

my_fn() {
  (( ${+functions[_zsh_highlight__zle-line-pre-redraw]} )) && _zsh_highlight__zle-line-pre-redraw
  # my functionality
}

zle -N zle-line-pre-redraw my_fn

Is that what you recommend?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions