Skip to main content

Questions tagged [os-clipboard]

Questions about interfacing with the system's clipboard.

Filter by
Sorted by
Tagged with
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?
thameera's user avatar
  • 17.6k
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.
Lonnie Best's user avatar
24 votes
1 answer
33k views

How do I use the system clipboard with Vim in Arch Linux? [duplicate]

I am using Vim on Arch Linux through urxvt. Since there is no "Ctrl-V" or "Ctrl-Shift-V" support in urxvt, there is no way for me to paste things I have copied from my browser (let's say) into my vim ...
alexytsu's user avatar
  • 846
21 votes
1 answer
8k views

How do I get +clipboard support in Fedora 20?

It seems to me that neither "+p nor "*p works for me. How can I know if my Vim is installed and set up properly to make them available? And if it's not set up, what can I do to set it up? I'm running ...
yo''s user avatar
  • 1,151
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.
Thomson's user avatar
  • 872
16 votes
3 answers
2k views

Paste link to image in clipboard when editing Markdown

I have an image on the clipboard and I want to paste it into my document as the text [](img/image1.png). Instead of first copying it to that directory, I want to do it with a single p key press in ...
Maxim Kochurov's user avatar
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....
erwin's user avatar
  • 281
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, ...
user avatar
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 ...
name's user avatar
  • 965
10 votes
2 answers
3k views

Difference between "* and "+ registers in +clipboard VIM?

"*p and "+p seem to behave the same. I tried :help "*, but it's talking about mouse selection, and :help "+ tells me There are three documented X selections: PRIMARY (which is expected to ...
minseong's user avatar
  • 2,363
10 votes
1 answer
6k views

Define custom commands for the * and + registers

If I'm using a build of Vim with the xterm_clipboard feature then the system clipboard content is available through the + register. If the build I'm using doesn't have this feature, can I make the "+ ...
Gilles 'SO- stop being evil''s user avatar
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 ...
ng.newbie's user avatar
  • 243
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 ...
Shuzheng's user avatar
  • 1,275
7 votes
1 answer
5k views

Neovim Clipboard Selection

I am using neovim 0.2.3 dev and xfce4-clipman clipboard manager. I want to copy from the neovim into registers and put it into clipman register. How can I do that?
3N4N's user avatar
  • 5,764
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 ...
J-Win's user avatar
  • 369
7 votes
1 answer
10k views

How can I copy over an ssh session without +clipboard?

On my local computer, I have the following in ~/.vimrc, which allows me use to the mouse (e.g. to select text) and to copy to the system clipboard with Ctrl+c. set mouse=a vnoremap <C-C> "+y ...
Sparhawk's user avatar
  • 580
7 votes
2 answers
1k views

Vi: * and + registers do not exist

I'm unable to use the system clipboard in Vim. I'm using ssh to connect to an EC2 instance running Ubuntu 18.04. I'm fairly sure that this has to do with neither the * or the + register showing up in ...
Cat's user avatar
  • 131
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, ...
clem steredenn's user avatar
7 votes
1 answer
2k views

What's the difference between the "clipboard" and "xterm_clipboard" features?

What is the difference between the clipboard and xterm_clipboard features? When do I need to enable one or the other at compilation time? As an aside, how do these features relate to the mouse ...
jalalhugo's user avatar
7 votes
1 answer
327 views

Can visual select mode be integrated with the Unix selection clipboard?

Is it possible to configure vim (obviously with :set mouse=a) and/or gvim such that the visual selection modes automatically integrate with X's selection buffer? I am aware of how to setup the copy ...
Caleb's user avatar
  • 2,245
7 votes
2 answers
1k views

Clipboard sharing broke under MacOS X

I'm using (roughly) the same config for my mac and my ubuntu machine. I use set clipboard=unnamed,unnamedplus To conveniently share vim's clipboard with the system clipboard. However, lately the ...
DeX3's user avatar
  • 403
6 votes
2 answers
12k views

How to select and copy lines to clipboard which are selected by mouse without linenumbers and gutter?

In my default Vim settings I've enabled a gutter and line numbers. Sometimes I copy some lines to clipboard in order to paste somewhere else. Currently I need to disable line numbers and the gutter. ...
OrangeTux's user avatar
  • 3,586
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 ...
Quasímodo's user avatar
  • 2,466
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 ...
Enlico's user avatar
  • 2,224
6 votes
0 answers
184 views

How to copy text to X primary selection only when visual mode is started with the mouse?

At the moment, if I use Visual mode, whenever I select a block of text using the keyboard it ends up on my X primary selection (ie the clipboard that is filled using the mouse). Even if I just select ...
Muzer's user avatar
  • 161
6 votes
0 answers
110 views

Prevent gvim from clearing the clipboard on exit [duplicate]

If I copy text into the xterm clipboard ("+y) from gvim, it is cleared when I exit gvim. How do I prevent this? I've found the solution for vim, but it doesn't work for Gvim: autocmd VimLeave * ...
DmitMedv's user avatar
  • 161
5 votes
1 answer
1k views

Can Vim add to the X11 clipboard or primary buffers without an external utility?

We can copy to both the + and * registers, but this doesn't actually copy the content to X's memory (apparently). If you copy something from Vim using the * or + registers and quit Vim, poof! There's ...
muru's user avatar
  • 25k
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....
Ortomala Lokni's user avatar
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. ...
TornaxO7's user avatar
  • 581
5 votes
1 answer
367 views

How to disable the clipboard being overwritten when highlighting text in visual block mode?

Say I've got a URL in the clipboard, I enter vim, I hit <C-Q> and highlight a word. Then I hit I<C-R>+ to insert the clipboard at the start of the selection. What actually happens is the ...
TankorSmash's user avatar
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': '...
laur's user avatar
  • 159
4 votes
3 answers
635 views

Is it possible to wrap characters around text every time you paste something from the system clipboard?

I am going to be pasting a lot of characters into a file. Each time I paste something, the pasted element will need to be wrapped in quotes and followed by a comma. Is there a way to automatically ...
drs's user avatar
  • 3,038
4 votes
2 answers
732 views

Install vim features

I have installed a tiny vim version without the clipboard feature. Can I load this feature for the current version or do I have to install another version of vim? $ vi --version VIM - Vi IMproved 7.4 ...
Hölderlin's user avatar
4 votes
0 answers
1k views

Vim adding blank line after each line when pasting from clipboard

When I copy-paste multiple lines from clipboard into my vim, it inserts a blank line after every line. But when I copy in into a text editor first and then copy-paste it into vim, the blank lines are ...
1zverg's user avatar
  • 211
3 votes
1 answer
391 views

Paste a column in a table

Suppose I have this file open in Vim: AXXK M(X) 1.1 1 1.2 8 And that the clipboard holds U(1X) MX1 MX2 How can I easily paste that content as a new column? I want: AXXK M(X) U(1X) 1.1 1 ...
Quasímodo's user avatar
  • 2,466
3 votes
1 answer
705 views

Windows 10 Clipboard

Windows 10 has a clipboard history which can be accessed using WIN+V it has a recent history of all your copy and paste. When using this in VIM and trying to paste from it doesn't work it acts like ...
Gideon Sassoon's user avatar
3 votes
2 answers
5k views

Make vim support the Windows clipboard

I've found a lot of information online about this for Linux-Vim but not for the Windows-Vim (not gvim). Whenever I try to copy and paste something in Vim (using y and p), the copies I make do not ...
Jon's user avatar
  • 131
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 ...
Volker Siegel's user avatar
3 votes
1 answer
1k views

copy-paste selection locally when editing files on remote headless server

When connected to a remote headless Linux server via SSH, I want to be able to do 3 things: select text using the mouse and copy the selection into my local X clipboard paste from local X clipboard ...
J-S's user avatar
  • 33
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 ...
Grzegorz Wierzowiecki's user avatar
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 ...
Antsamotady's user avatar
3 votes
1 answer
479 views

unable to copy to system clipboard with +clipboard and +xterm_clipboard in vimx

The system is Centos7.2. I have installed vim-enhanced and vim-X11, used vimx command. It shows that vimx supports clipboard and xterm_clipboard. But in vimx, there is no reg + and reg *. I can't ...
abgnwl's user avatar
  • 31
3 votes
1 answer
5k views

Can't yank into * or + registers [duplicate]

I'm trying to yank to the system clipboard on Ubuntu 14.04. I can't yank into the + or * registers, though. Every time I visually select my text and type "*y or "+y the indicator on the bottom right ...
fuzzybear3965's user avatar
3 votes
0 answers
265 views

Is there a content length limit on the selection and drop register "+?

When selecting about two dozens of lines in vim and copying it to the system register ("+ y), and then paste it into another vim, it crashes. It does not paste the content of the register and the ...
B.Kocis's user avatar
  • 131
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 ...
KrabbyPatty's user avatar
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. ...
coin cheung's user avatar
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 ...
Hrolfson's user avatar
2 votes
1 answer
1k views

How to automatically perform a command after yanking text [Vim wayland clipboard]

I want to copy contents of the recently used " register automatically into my system clipboard after a yank command. The way I achieve this now is by nnoremap <C-@> :call system("wl-copy", @")&...
brother-bilo's user avatar
2 votes
1 answer
362 views

Copying to unnamedplus doesn't work across instances

Whenever I copy with "+y it only works for the instance of vim I am running and I would expect it to write to my system clipboard, that I can access both outside of vim and from other vim instances. ...
Armin's user avatar
  • 23
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 ...
Enlico's user avatar
  • 2,224