What I often have to do is to copy something from my editor to the browser and vice versa. But this seems not so easy in some editors. I feel I have to add that I’m on wayland under hyprland.

In some Editors it’s super easy like GNOME Text Editor or nano, you mark some code in the text editor with the mouse and then in the browser you press the middle click on the mouse where you want to paste it, done. You could do it with ctrl-c and ctrl-v but with the mouse only it’s just so much faster. And it works both ways browser <–> editor

But in VSCodium I can do that from editor -> browser, but I can’t do it from browser -> editor, I have no idea why.

In neovim it’s the opposite I can do it from browser -> editor, but I can’t do it from editor -> browser.

Any ideas what is going on?

  • thingsiplay@beehaw.org
    link
    fedilink
    arrow-up
    3
    ·
    2 days ago

    There are couple of factors that makes this a confusing topic.

    Vim: On a high level, normally Vim (and Neovim) have their own clipboard system. Vim has multiple internal clipboards that can be used like variables and accessed with other commands. So its kind of sandboxed from your system. But you can explicitly use the commands to access the system clipboard. There is a configuration you can set to use the system clipboard by default.

    Linux: Unlike Windows, in Linux we also have two kind of clipboards: the “system” clipboard as you know and the “primary” clipboard. This has nothing to do with Vim and is a feature on Linux systems itself. If you in example in your browser mark a text without copying, it is automatically copied into the “primary” clipboard. Then you should be able to access and paste it with middle mouse button in example. The system clipboard where you explicitly copy stuff is not affected by it.

    You should read following documentation: 09.3 The clipboard - Neovim