3

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. :)

5
  • 3
    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
  • @Heptite Would you please turn that into an answer? Thanks!
    – filbranden
    Dec 6, 2021 at 18:58
  • 1
    @Heptite thanks, that works I think.
    – cmosig
    Dec 6, 2021 at 19:16

1 Answer 1

6

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, privacy policy and cookie policy

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