5

I have case where I would like to trigger the TextChanged event manually without actually changing the text. Would that be possible? How?

I know it's hacky, but it would make my life easier right now. :)

3
  • 4
    Are you aware of :doautocmd?
    – Heptite
    Dec 6, 2021 at 17:16
  • No. Do I understand the help page correctly? If I do :doautocmd TextChanged, then all autocmds triggered by TextChanged will run?
    – cmosig
    Dec 6, 2021 at 18:30
  • 1
    Yes, or you can get specific on which group and/or events to trigger.
    – Heptite
    Dec 6, 2021 at 18:49

1 Answer 1

8

What you are looking for is :doautocmd. With this you can trigger all the autocmds in an event, or just those that match a specific pattern. Or you can scope based on autocmd group. For example, to trigger all the TextChanged events:

:doautocmd TextChanged

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.