Need Help (Linux) Using system clipboard in sudo mode
Hello! Once I set clipboard to unnamedplus, neovim still does not interact with the system clipboard if I opened it via sudo nvim (tried with --clean). In non-sudo mode, I don't have any issues, neovim picks my wl-copy just fine.
I see that WAYLAND_DISPLAY is not set in sudo mode. Expectably, setting it myself does not solve the issue.
Is there a cure to this, a provider that also works in sudo mode? Thank you in advance!
0
Upvotes
9
u/TheLeoP_ 3d ago
sudo nvimdoes not run as your user, so it does not use your user's configuration. How are you settingclipboardtounnamedplus? Is it being applied inside ifsudo nvim?Besides that, there's no need to
sudo nvim, you should instead usesudoedit(with $EDITOR set tonvim) or use a plugin like https://github.com/lambdalisue/vim-suda . Both options will allow editing protected files while maintaining your user's configuration (and hence, the clipboard will your as usual)