-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
performance: defer clipboard because xsel and pbcopy can be slow #2940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/options.lua#L12 you should add it here |
Unfortunately, if the user decides to change the clipboard option in his own lua/options.lua, there is no way to reset and defer the option. -- User options.lua in "NvChad/starter": require "nvchad.options"
-- add yours here!
local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
-- Not deferred!
o.clipboard = "unnamed" -- or a custom clipboard tool config, see ":h g:clipboard"-- Nvchad options.lua in "NvChad/NvChad": vim.schedule(function()
o.clipboard = "unnamedplus" -- overrides user's changes...
end)I also tried the approach in an autocommand on EDIT: An example of "doing something" with spec.config supplied by the user can be found here |
|
ig its better to remove the cliboard function from main repo itself and let the user add it in his starter.. I dont get why such simple option should be heavy, i hope its not cuz of windows 😨 😡 |
Yes, that would be the best option. I think that existing users would not profit though.
That's discussed here. It can happen on linux("xsel"), macos("pbcopy") and windows-wsl2, as far as I can see. Would you like me to propose a PR on the starter? |
|
what if the main nvchad's repo's option file had just this? vim.schedule(function()
o.clipboard = "unnamedplus" -- overrides user's changes...
end) |
|
That would work except when the user adds his own clipboard setting to The problem, I think, is that in the starter, in NvChad's config function, That's why I ended up with |
|
I found a better approach and pushed a new commit. I used the local
The code now uses an |
|
@abeldekat the user can add his own vim.schedule... in his options file |
|
Yes, the user can do: o.clipboard = "" -- reset
vim.schedule(function()
o.clipboard = "unnamedplus"
end) |
See this discussion in LazyVim
The approach discussed has been merged in LazyVim and AstroNvim
TLDR:
Startup time performance is affected quite significantly when the clipboard provider is
xsel(linux) orpbcopy(macos). I expect an improvement in these cases, especially on older pc's.This PR makes sure that
vim.opt.clipboardis only applied afterUiEnter@siduck, in case you are interested, please let me know if the code needs adjustments.
I "decorated" the config function defined in `Nvchad/starter".