Add tracing support by cyan12green · Pull Request #20339 · vim/vim · GitHub
Skip to content

Add tracing support#20339

Draft
cyan12green wants to merge 1 commit into
vim:masterfrom
cyan12green:tracing-support
Draft

Add tracing support#20339
cyan12green wants to merge 1 commit into
vim:masterfrom
cyan12green:tracing-support

Conversation

@cyan12green

Copy link
Copy Markdown

Built-in support to log and print the last few typed keys and executed commands. To be used for debugging or understanding what went wrong. Could also be used for statistics. Allows for various verbosity and filtering levels.

related: #12046
related: #12063

This is my first time contributing, so any feedback is welcome. Currently, I haven't added any support for scripts, plugins or autocmd, so if I am heading in the right direction, then I can work on that.

Regards,
Sid

@cyan12green cyan12green force-pushed the tracing-support branch 2 times, most recently from eda6f69 to bcc1533 Compare May 27, 2026 10:58
@h-east

h-east commented May 27, 2026

Copy link
Copy Markdown
Member

@h-east

h-east commented May 27, 2026

Copy link
Copy Markdown
Member

The decisive question: extend, don't duplicate

To make point 1 in my previous comment concrete: stepping back from naming and
option count, there is a more fundamental question worth settling before more
work goes in.

The only genuinely new thing here is a bounded, always-on, in-memory ring
buffer of recent events that you can dump after the fact. Almost everything
else already exists in Vim, just spread across separate mechanisms:

(See above my comment)

So the question is:

Why can't this be added as an extension of one of those existing
subsystems
— for example an in-memory / ring-buffer mode for
'verbosefile'/:verbose, or building on the message-history or ch_log
infrastructure — instead of a new :trace command plus its own option
family?

I think the burden of proof is on introducing a new parallel subsystem.
Adding a new top-level command and a new option family has a high bar in Vim
precisely because a second, overlapping system fragments where users look,
duplicates the buffer/parse/doc/test code, and splits the concept of "recent
activity" across two stores that then have to be kept consistent. If the gap
genuinely cannot be filled by extending an existing facility, that's a strong
argument for the feature; if it can, the new subsystem is hard to justify
regardless of how it's named.

This isn't a request to scrap the idea — the ring-buffer-you-dump-later angle
is real. It's a request to pin down where it should live before polishing the
surface.

@chrisbra

Copy link
Copy Markdown
Member

I agree, it seems to duplicate a bit of existing functionality. On the other hand, I think it could also pave the way to e.g. the settable dot register: #19413

@chrisbra

Copy link
Copy Markdown
Member

Marking as draft for now

@chrisbra chrisbra marked this pull request as draft May 27, 2026 15:21
@cyan12green

Copy link
Copy Markdown
Author

Problem:  Built-in tracing and profiling support of all the
	  commands/inputs/scripts/plugins.
Solution: Add configurable tracing support with documentation and
          tests (Siddarth Balaji).

Built-in support to log and print the last few typed keys and executed
commands. To be used for debugging or understanding what when wrong.
Could also be used for statistics. Allows for various verbosity and
filtering levels.

related: vim#12046
related: vim#12063
related: vim#19377

Signed-off-by: Siddarth Balaji <49455519+cyan12green@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants