Skip to main content

Questions tagged [os-clipboard]

Questions about interfacing with the system's clipboard.

Filter by
Sorted by
Tagged with
1 vote
1 answer
306 views

How to copy contents of wl-clipboard into a Vim register?

I would like to swap content between my system clipboard and a Vim register. I am missing one last piece of the puzzle, indicated below. Any thoughts? map <Leader>" :call SwapBuffer()<CR&...
1 vote
1 answer
96 views

Choices for pasting

In my local PC I use p in Vim command mode for pasting and it works fine and the :echo has('clipboard') returns 1. But, in the cluster I am working p in command mode, which just inserts a 0 instead of ...
0 votes
0 answers
205 views

Yank to host clipboard when using nvim from Docker (WIndows)

NVIM v0.9.1 Windows10 I'm using neovim in Docker Desktop. Usually, when I use nvim in WSL2, I can yank / paste via "+y / "+p. But if neovim in Docker Desktop doesn't support the same ...
0 votes
1 answer
659 views

How can I make NeoVim's clipboard work on my linux servers (like nano)?

I cannot get NeoVim to work like nano does out of the box with regards to clipboard copy/paste. Here is exactly what I am trying to do: I use either a linux laptop (Linux Mint) or a Chromebook ...
0 votes
1 answer
42 views

Neovim blocks kitty select to copy and click on url to open with mouse

Kitty has configuration like opening a url in browser when it is clicked and copying text selected with a mouse to clipboard automatically. This works on Vim but does not work in Neovim. How can these ...
0 votes
1 answer
944 views

Pasting from system clipboard adds an unwanted new line

On windows, using neovim, with clipboard=unnamedplus , when I paste from the system clipboard using p or :put , it will always paste in a newline , even if the content of the clipboard has no newline. ...
0 votes
1 answer
35 views

How can I copy the current filename and line number to the clipboard?

How can I copy the current file name and line number to the system clipboard, formatted like this: relative/path/to/file:123 And how can I map this to a leader key command?
2 votes
1 answer
809 views

When I use the yank command in Vim, is the text saved into a buffer that is not visible to the user?

I understand the concept of a buffer. It is the text that's saved from a file that we edit inside of Vim. When I use the yy command, where exactly does Vim save this information to? In any other ...
3 votes
1 answer
317 views

How to diff the current text and the clipboard?

How to create a diff of the current text and the clipboard? It could result in a vertical split showing the clipboard content, and a normal diff between them. Opening a vertical split, pasting and ...
0 votes
2 answers
51 views

How to copy text to clipboard from status bar (statusline) in Vim

Problem is present when there is the following option for mouse in ~./vimrc: set mouse=a | " active
513 votes
15 answers
696k views

How can I copy text to the system clipboard from Vim?

Is there a way to copy a block of text to the system clipboard, so I can paste it in another program?
1 vote
3 answers
262 views

Exclude empty lines when copying

I'm writing Python programs using Vim/NeoVim. One thing I often do is copying text to the system clipboard using "+y command. This lets me copy parts of the program to the clipboard, and run it ...
1 vote
1 answer
189 views

Copy from Visual mode to clipboard using Wayland

This works well when I'm not using Wayland on Fedora 39 KDE: nnoremap <C-c> "+ vnoremap <C-c> "+y But this doesn't work anymore on Wayland. What can I do to make it work? My vi -...
9 votes
6 answers
3k views

Clipboard is reset after first paste in Visual Mode

I am on Neovim. This is really annoying and weird. When I make a selection in Visual Mode and copy, then select a text and then paste, this paste only works once. For the next time, I again have to ...
11 votes
6 answers
32k views

How do I copy and paste between two Vim instances - shared clipboard?

I use gnu screen and I run vim file1.txt and vim file2.txt in two windows. How can I copy part of the text from file1.txt and paste it to file2.txt without using temporary files or opening two files ...
24 votes
4 answers
6k views

I Have a Problem with Premature Yanking

If I've already yanked 37 lines, is there a way to send them to the clipboard without having to select them again? I need to move those yanked lines into a GUI application.
5 votes
2 answers
5k views

Not able to copy from terminal when using vim from homebrew on macOS

When using the vim installed by default in macOS 10.12.5, I can copy text from the terminal by using cmd-C and pasting it into another applications. But when I use the latest version of vim (8.0....
0 votes
1 answer
71 views

Change the clipboard register's name

To use Neovim with my system clipboard I have to use the + register which I find inconvenient. When I type something like "+p I have to bounce my pinky all around. Is there a way to change the ...
0 votes
0 answers
260 views

Copy to android system clipboard in nvim from termux

I use Neovim on termux on android 11 I commonly use :y to yank/copy text to nvim clipboard Then paste it to another files Recently I've tried using helix-editor(hx) looks and feels so similar to ...
7 votes
2 answers
2k views

Copying From Vim to Ubuntu Bash on Windows

Note: this question is specific to the relatively new Ubuntu Bash on Windows system. So it seems possible to paste into Vim from the Windows clipboard by simply right clicking in insert mode after ...
1 vote
1 answer
118 views

Syncing x clipboard with yanks and put only?

I have discovered the joy of having :set clipboard^=unnamedplus. One issue I often face however is having whatever was last copied or yanked be overwritten by what I just deleted. I don't think ...
0 votes
1 answer
791 views

Prevent neovim from overwriting system clipboard while cutting, copying or deleting text

As the title says, I want to disable neovim from overwriting existing content of my clipboard. I am using elementary os 7 horus and nvim v0.10.0-dev-115+g240c41e1a downloaded from github release page. ...
1 vote
1 answer
13k views

How to install neovim with +clipboard extension?

I have NVIM v0.4.3 installed on Debian 10. When I run: :echo has('clipboard') I get 0, which means that this extension is not available. I cannot copy to OS clipboard using "+y and "*y ...
5 votes
1 answer
882 views

How to set copyq to handle clipboard?

I want to let CopyQ clipboard manager handle clipboard (I am using set clipboard+=unnamed setting). To that end, this setting was added to init.vim file: let g:clipboard = { \ 'name': '...
15 votes
3 answers
10k views

Vim on WSL: synchronize system clipboard? (set clipboard^=unnamed)?

While using WSL/Bash for Windows I want to be able to use y yy 3y and p the same way they always work in vim, but connecting to the system clipboard shared by all apps, not to vim's internal clipboard....
1 vote
1 answer
939 views

Copying from Windows clipboard

On my Windows 10 box, when using git bash, I am able to righ-click on git bash window and choose paste to flush the contents of the Windows clipboard to my vi text buffer. Now, when I ssh into a ...
1 vote
1 answer
823 views

Always duplicate yanked text to system clipboard

I'm using neovim 0.8.2 Is there a way to automatically mirror last yanked text to system clipboard, regardless of which register I used to yank it to? So if I run something like "ayiw I will have ...
0 votes
2 answers
765 views

"Copy" is greyed out in the Terminal menu after "Select All" in "VIM embedded in Terminal"; VIM copy does not work. How to copy the full file text?

I have set VIM as the default editor in the Terminal. I changed the ~/.bashrc: export VISUAL=vim export EDITOR="$VISUAL" You can also set the default editor only for git: git config --...
0 votes
1 answer
441 views

Nvim on WSL: escaping space in g:clipboard.paste['*']?

According to :h clipboard-wsl in neovim, For Windows WSL, try this g:clipboard definition: let g:clipboard = { \ 'name': 'WslClipboard', \ 'copy': { \ '+': 'clip.exe', \ ...
2 votes
3 answers
3k views

How could I enable vim clipboard without sudo and x11 installed?

I am given an account on a new server these days. The new server does not have x11 install, neither do I have sudo. So I cannot install system packages, and I cannot compile with the option -with-x. ...
7 votes
1 answer
5k views

Compiling Vim from source just enabling clipboard

I have a Debian 7.0 with gnome, and I am fully satisfied with the standard vim version installed on it, except for the lack of +clipboard and/or +xterm_clipboard. I got the sources using mercurial, ...
1 vote
0 answers
78 views

Vim only sometimes choosing to copy to system keyboard

I have the following situation. If I open a file in Vim, say by running vim myfile.tex, select something in visual mode, and do "+y, it is in the system clipboard as one would hope. If however I ...
2 votes
1 answer
45 views

How do the * and + registrers behave in the virtual console?

My Vim is installed with +clipboard support, and all works just fine. I know that the clipboard comes with X, so there isn't such a thing in a virtual console (or, at least, this is what I've ...
1 vote
0 answers
56 views

No + or * register on Linux (accessed via SSH from macOS)? [duplicate]

I am on Ubuntu 14.04.3 and Vim 8.2. I'm trying to figure out how to access either the * or + clipboard on Ubuntu but it seems like it doesn't exist? After doing "*yy and "+yy on lines of ...
3 votes
1 answer
4k views

gvim copy/paste shortcuts like in terminal : ctrl+shift+v / c

In terminal I use: Ctrl+Shift+c and Ctrl+Shift+v to copy & paste. I would like Ctrl+c, Ctrl+v in gVim to have standard Vim behaviour. How to configure gVim, so Ctrl+Shift+c and Ctrl+Shift+v become ...
6 votes
3 answers
3k views

Install Vim with +clipboard support but without Gvim?

My distribution comes with a minimal version of Vim. vim --version returns -clipboard, so the * and + registers interact (copy/paste) with the primary and clipboard do not work. The resources I've ...
19 votes
1 answer
10k views

Copy the full path of current buffer to clipboard

Is there a quick way to copy the full path of current buffer to system clip board or some register? :put=expand('%:p') then use other copy commands(like dd) works but the typing is a little long.
0 votes
1 answer
213 views

Copy to clipboard and cut at the same time?

I often copy to clipboard into other programs (changed to <leader>y) is there a way to copy to the clipboard and delete once copied in one command? For example, I want to press <leader>y, ...
-1 votes
1 answer
302 views

How to always paste to clipboard? [duplicate]

I am searching for an option to always paste to the system clipboard when using any kind of yank action, because I want to use Vim as the scrollback buffer for Kitty. I have already tried clipboard=...
0 votes
0 answers
362 views

Yanking to system clipboard does not work

I'm on Ubuntu 20.04.3 LTS, I have +clipboard and +xterm_clipboard in my vim --version, and I have set set clipboard=unnamedplus in my .vimrc. For some reason, yanking still does not copy to the system ...
1 vote
1 answer
70 views

How do I yank the next 4000 chars, ignoring linebreaks?

I can for example, copy three lines to the clipboard with "+y3j. But I nothing happens when I attempt to yank chars to the clipboard with, say,"+y100l. Ultimately, I want to copy chunks of ...
12 votes
7 answers
13k views

How can I copy/paste new text without auto-indentation at every new line?

How I paste now: Right-click/Copy or simply highlight. Right-click/Paste or Middle Click or CTRL+SHFT+V Indents appear at increasing intervals: 0, 2, 4, 6, + Question at hand: From prior research, ...
3 votes
2 answers
1k views

How do I enable copy/paste between vim and tmux in both two directions?

In a tmux session, I'm running vim in one pane and a terminal in another pane. Recently, I figured out how to enter visual mode in tmux but it doesn't help much now. Can I yank selected text from a ...
8 votes
1 answer
643 views

How to prevent Vim from clearing the system clipboard (:reg +) on exit?

After copying text to the system keyboard clipboard in vim, I'm unable to paste the text after exiting vim. I find this behavior frustrating, since I often copy text in files to paste it on the ...
0 votes
0 answers
185 views

how to copy text with mouse when nu and mouse=x is set in neovim

The only time the mouse does not select the numbers when mouse is set is if mouse is set to v. But you cant copy the text with right click or menu key.
2 votes
1 answer
975 views

Mapping <Shift>-Insert to paste in gVim search field

In gVim (not terminal Vim), I want to be able to paste from <Shift>-Insert (a.k.a. C-V) into the text input field of a search. I.e. when I press "/", and go into search mode, I want ...
6 votes
1 answer
316 views

How do registers + and * interact with suspending Vim via Ctrl-Z?

As show in the following screencast, I see that using Ctrl-Z makes most recent written register of + and * overwrite the other one. You can see me doing the following: opening a file via vi -u NONE ...
0 votes
1 answer
290 views

What's the easiest way to replace some text with the contents of the clipboard when using clipboard=unnamed?

Assume I've copied some text into the clipboard from another program. I'm on MacOS, so in Vim terms, this means the text is in the + and * registers (I have verified this using :registers). I use ...
0 votes
0 answers
135 views

Online vim via browser, but with copy/cut/paste to/from Windows clipboard

I visited another city and forgot to bring my laptop. A friend offered to let me use his Windows 10 account, but without installing anything (including cygwin from a non-administrator account). It's ...
5 votes
2 answers
2k views

Copy vim messages into clipboard

When I'm confronting a bug of a plugin and an error message pops up like this one: E5018: Error executing lua ... and if I want to report this bug, I always have to type this error message manually. ...