Skip to content

Conversation

@kdkasad
Copy link

@kdkasad kdkasad commented Apr 12, 2025

Instead of using shell commands via io.popen() and os.execute(), this PR changes the code to open a handle to the standard output TTY, and write to it directly.

This improves plugin load time from ~8 ms to ~1 ms (on my laptop), which is nice. It also makes execution slightly faster each time the background is updated, which is not noticeable on fast machines, but is on slower ones. (I see a noticeable lag in background color updates on a slow university server without this change.)

This PR also replaces the deprecated vim.api.nvim_get_hl_by_name() function with vim.api.nvim_get_hl().

I've tested this in Ghostty and in a tmux session, and both work as expected. I do not have Kitty installed, so I haven't tested the Kitty-specific functionality.

@PowerUser64
Copy link

You can remove the last printf call if you replace line 33 with this: tty:write '\x1b]30001\x07'. Also, I tested these changes with kitty and it all seems to work just fine!

Instead of using shell commands via io.popen() and os.execute(), we now
just open a handle to the standard output TTY, and write to it directly.
@kdkasad
Copy link
Author

kdkasad commented Oct 24, 2025

You can remove the last printf call if you replace line 33 with this: tty:write '\x1b]30001\x07'. Also, I tested these changes with kitty and it all seems to work just fine!

Thanks! Added that change.

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.

2 participants