neovim / neovim

Vim-fork focused on extensibility and usability
https://neovim.io
Other
82.8k stars 5.66k forks source link

unnamed and unnamedplus causing problems with long-press delete actions #23748

Open maztaim opened 1 year ago

maztaim commented 1 year ago

Problem

I occasionally like to delete characters or lines by long-pressing x or d. Recently, I've not been able to do so. After looking through everything, it appears that when vim.o.clipboard = 'unnamedplus' or vim.o.clipboard = 'unnamed' is set in init.lua, I see an unexpected behavior where the long-press only deletes one character or line, then stops.

Steps to reproduce

nvim --clean
:set clipboard=unnamedplus

or

:set clipboard=unnamed

create some characters hold down x to delete a random amount of characters.

create some lines hold down d to delete some lines.

Expected behavior

mash 'x' in normal mode and delete characters until I lift.

mash 'd' in normal mode and delete lines until I lift.

Neovim version (nvim -v)

v0.10.0-dev-382+gebb10d624

Vim (not Nvim) behaves the same?

no, vim-minimal-9.0.1562-1

Operating system/version

fedora 38

Terminal name/version

alacritty 0.12.0

$TERM environment variable

alacritty

Installation

build from repo

zeertzjq commented 1 year ago

What unexpected behavior did you see?

maztaim commented 1 year ago

It only deleted one character, or one line. I updated the description with the details.

maztaim commented 1 year ago

I also did a bit more testing, I updated the title and description to include unnamed as being a problem, though to be fair, I don't normally use unnamed, so I don't have a baseline for that.

I am using wl-copy 2.0.0 and tmux 3.3a from fedora 38 repos. I am not aware of any tmux configs that may cause a problem.

I'm happy to assume it's me that's the problem, but so far it seems to be specifically those clipboard settings that I can see.

zeertzjq commented 1 year ago

Cannot reproduce using wl-copy 2.0.0 or 2.1.0 and tmux 3.3a

maztaim commented 1 year ago

I thought maybe it's alacritty? I tried with gnome-terminal, still experiencing the problem when clipboard is set to either unnamed.

maztaim commented 1 year ago

This seems to be wayland, wl-copy, or my lack of understanding how to configure clipboard. I switched to gnome on xorg and ran through the same steps. I am now able to delete multiple characters and lines, but I get clipboard: No provider. Try ":checkhealth" or ":h clipboard". on my initial attempt, which I expect since I am now on x instead of wayland. I installed xclip and the message goes away as well.

maztaim commented 1 year ago

I am chalking this up to my lack of experience here. My solution was to just let neovim pick it's clipboard tool. I can't even remember why I was using unnamed(plus) with wl-copy hanging around...

sktt commented 8 months ago

I am having this issue too. I use unnamedplus to use the same clipboard the rest of wayland.

maztaim commented 7 months ago

I'm a little more confident, it doesn't matter what terminal I use, if I use any clipboard, the hold behavior goes away.

sktt commented 7 months ago

As far as I understand the problem only happens on gnome in wayland.

i think it's related to that wl-copy is forced to create a fake window to copy, which loses focus of neovim and held down key stop being registered when it returns to neovim.

so maybe it's more related to how nvim spawns the wl-copy process.. I wonder why plain vim does not have this problem...

sktt commented 7 months ago

Related: https://github.com/neovim/neovim/issues/11804 https://github.com/neovim/neovim/issues/12622 ( nice example ) https://github.com/neovim/neovim/issues/17919 https://github.com/AstroNvim/AstroNvim/issues/806 https://github.com/neovim/neovim/issues/25180

ArnaudD-FR commented 2 months ago

Hello, I encounter this issue on Ubuntu 24.04 with neovim 0.9.5 and neovim 0.10.1. I use terminator as terminal but I have the same issue with gnome terminal.

My clipboard is configured to unnamedplus, so accordingly to this documentation neovim should use wl-copy.

How can I be sure wl-copy is really used?

Sometimes I see my terminal window blinking when this issue occur, it might be related to what @sktt mentionned

ArnaudD-FR commented 2 months ago

Just answering to myself, removing wl-clipboard package generates a warning in neovim claming no clipboard provider is installed. So wl-copy is used too in my case.