18
submitted 1 week ago* (last edited 1 week ago) by jeena@piefed.jeena.net to c/programming@programming.dev

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?

top 14 comments
sorted by: hot top controversial new old
[-] bedheadkitten@lemmy.world 4 points 6 days ago* (last edited 6 days ago)

Have you installed a clipboard, like wl-clipboard? you also have to set it up in neovim init.lau fila also with "clipboard=unamedplus" if you want it to be on your system clipboard similar to what you describe. The normal neovim setup is that the nvim clipboard is separate from the system one, but you can copy into it from neovim by using marks like "+yy etc. It's nice to have two separate if you can get used to it.

Edit: here is a guide. Disclaimer, i dont know if its good I only skimmed it https://hatchjs.com/neovim-copy-to-system-clipboard/

[-] FizzyOrange@programming.dev -4 points 6 days ago

Yeah of Linux on the Desktop!

First you'll need this guide to make copy & paste work... 🤦🏻‍♂️

[-] bedheadkitten@lemmy.world 6 points 6 days ago

Yeah well last time I checked noone is forcing anyone on linux to use neovim as a text editor. You can just use nano or Kate or sublime or vscode or.... dosent matter. Vim != linux, in case your usure about what the topic is here.

[-] tetrislife@leminal.space 1 points 6 days ago

I sympathize. Using a neovim GUI should make things just work. Terminal and graphics never played well together, although you found nano to behave well.

[-] Tempy@programming.dev 8 points 1 week ago* (last edited 1 week ago)

The simplest and slowest way when you need to use something from the system clipboard:

Copying: Enter visual mode (v) Highlight the text I want to copy then enter in command mode "+y which basically means "Use a register for following command (") make it the external clipboard register (+) and yank/copy (y)"

Pasting Move to where I want to paste then enter in command mode "+p to paste after the current position or "+P to paste before the current position

If I don't need to copy/paste stuff to applications outside of vim, then I can skip the "+ register setting part, and just use the default internal register.

[-] e8d79@discuss.tchncs.de 5 points 1 week ago

You can also add set clipboard=unnamed to your .vimrc. This makes it so that all yank and paste operations use the system clipboard, but I find it gets in the way more often than it helps.

[-] Coelacanthus@lemmy.kde.social 2 points 6 days ago

In most cases, yank in Vim just need somewhere to store contents temporarily, not share it with others.

[-] thingsiplay@beehaw.org 4 points 1 week 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

[-] karlhungus@lemmy.ca 2 points 1 week ago

Search for "copy from nvim to clipboard" you should get something right away.

I'd your highlighting text and copying that then it's your terminal not neovim

[-] jeena@piefed.jeena.net 1 points 1 week ago

But if it's the terminal (kitty) why does it work nicely in nano but not neovim?

[-] Dunstabzugshaubitze@feddit.org 6 points 1 week ago

https://vim.fandom.com/wiki/Copy,_cut_and_paste

i assume you are discovering (n)vims registers here. vim does not copy to your clipboard nor from it, unless you specify a special register for the operation.

it's one of those cases where vim feels off, until you find an awesome way to utilize it, then it's feeling like the greatest editor ever again.

[-] karlhungus@lemmy.ca 1 points 1 week ago

Ctrl+c works in terminal and nano but not neovim?

[-] jeena@piefed.jeena.net 1 points 1 week ago

Ctrl-c works everywhere I guess, but normally I don't use it, I use marking the text and pasting it with the middle click (scroll wheel) on the mouse.

[-] karlhungus@lemmy.ca 1 points 1 week ago

On osx I use alt (option I believe) for copying from the terminal, and that carries over with nvim. Admittedly I tend to use pbcopy for larger amounts of text

this post was submitted on 18 Jul 2025
18 points (100.0% liked)

Programming

21752 readers
122 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS