gorbit99 / codewindow.nvim

MIT License
431 stars 16 forks source link

Feature: let users configure events #51

Closed pocco81 closed 1 year ago

pocco81 commented 1 year ago

Codewindow tends to be very slow (at least on my machine) while editing big files (800+ LOC). This is particularly noticeable when typing. I read through the source code, and found that the Codewindow in being update on TextChanged (relevant file: https://github.com/gorbit99/codewindow.nvim/blob/master/lua/codewindow/window.lua#L94)

I would like to be able to customize all (or to the very least, the one I mentioned above) event(s), mainly those that trigger Codewindow's updates. This shouldn't be that hard to implement.

An alternative solution (though not the best option) could be to delete these augroups and define them myself (on my config):

vim.api.nvim_del_augroup_by_name("CodewindowAugroup")
llocal augroup = vim.api.nvim_create_augroup('CodewindowAugroup', {})
-- .. define the autocmds to my liking 
gorbit99 commented 1 year ago

Great suggestion. I'll try to work it into the non-wip version in a bit.

pocco81 commented 1 year ago

Awesome, thanks!

Edit: I think you should consider removing the TextChanged event by default. Since it's triggered so often it can cause some serious lag. Even vim's doc advises about its use; see: help TextChanged (the "Careful" section).