All Questions
Tagged with paste or cut-copy-paste
494 questions
0
votes
0
answers
22
views
Paste clipboard linewise if it has new lines, or characterwise if it does not
I would like to remap all paste commands to take these special actions before pasting the system clipboard "+ register:
if the register is not "+, paste according to default behaviour
...
0
votes
0
answers
35
views
Errors when copying and pasting text using gVim under Windows 11
I have a reoccurring problem when using Ctrl c and Ctrl v between two files opened in gVim Version 9.1.
When I copy a portion of text from file 1 and then paste it in file 2 I get various "extra&...
0
votes
1
answer
32
views
How to I paste the word I copied before deleting something?
I am a new Vim motions user, I use it in VsCode. The most annoying thing that I run into constantly is that when I try the following:
const animal = "dog";
const pet = "cat";
I ...
1
vote
1
answer
37
views
Vim suddenly "forgets" whether yanked text was character-wise or line-wise
I have a habit of copying lines of text across files by yanking it, closing Vim, starting Vim with the target file, then p. However, earlier today Vim started to forget that I yanked whole lines of ...
0
votes
0
answers
19
views
Multiline graphical table to seperate lines
I have a (very large) variable width table, something like this:
1
-----------------
2 | 3 | 4 |
| | ---- | ...
1
vote
1
answer
85
views
Problems using Vim to yank to clipboard
I can't seem to yank to clipboard within Vim on Ubuntu (Windows Subsystem for Linux). I am pressing "+y and it's giving me the regular X lines yanked, instead of X lines yanked into "+ to ...
0
votes
1
answer
74
views
Vim visual block copy don't paste in KDE konsole
Selecting by visual line mode and copying (V and y) in vim in rxvt-unicode or in gnome-terminal and pasting in another tab of that terminal with Shift + Insert works well.
But trying to do the same ...
0
votes
1
answer
125
views
Why do I need to type ggVVG to select all, instead of just ggVG? [closed]
Sometimes, ggVG does not work to select text. It will move the cursor to the top, but not select the text. This happens seemingly randomly. I have figured out if I type ggVVG it will work as expected. ...
0
votes
2
answers
596
views
How do I synchronize system clipboard and nvim clipboard?
I would like to synchronize the system and nvim clipboards so I don't have to do anything extra to copy and paste. I want to do (since I am on MacOS) command c to copy and command v to paste, inside ...
7
votes
4
answers
2k
views
Why does `p` not put all yanked lines after quitting and reopening Vim?
I have the following workflow:
Open Vim
Use Visual mode linewise (V), select some lines, and yank them (y)
I get a message "151 lines yanked" or something like this
Quit Vim
Start another ...
0
votes
1
answer
46
views
How to yank only to specified register and do not touch (change) default " register?
I have mapping for duplicating current line in insert mode:
inoremap <C-d> <Esc>`^mzYp`zi<Down>
I want to set up it in a way it does not change default " register by specifying ...
0
votes
0
answers
13
views
How can I put a bullet point above or below the current line and have the same indent level automatically? [duplicate]
Let's say I have these bullet points
- First Line
- Second Line
- Third Line
On the second line I do dd, move down to the third line and do p, the second line gets pasted below with no indent, ...
0
votes
2
answers
68
views
How do I cut lines to the clipboard?
In traditional text editors, we have two distinct operations that remove text from a document:
Delete, which removes the text
Cut, which copies the text to the clipboard before deleting it (as above)
...
1
vote
1
answer
70
views
Paste in front or after in visual-block mode?
I can enter visual-block mode using <C-v>, move down a couple of rows by pressing j several times, then paste some content from the registry via pressing p or P. However, the pasting will ...
-1
votes
1
answer
29
views
Smart yank+paste function arguments
I find myself sometimes having to rearrange arguments to functions in C-like languages. I.e. changing:
hello("world", makeExclamation(1), foo(bar(a, b, c)))
->
hello(foo(bar(a, b, c)), &...
1
vote
1
answer
198
views
Copy text from remote headless Neovim server using local Neovim --remote-ui
I have a docker container running nvim --headless --listen 0:0:0:0:7777
I can connect to it successfully with nvim --remote-ui --server localhost:7777
There does not seem to be any built in copy ...
0
votes
3
answers
230
views
Paste in visual block mode
I would like to copy some text into the beginning of several lines.
What I have is:
line
111
222
333
444
And what I want is:
line
line 111
line 222
line 333
line 444
I know that I can add line at ...
0
votes
1
answer
56
views
Yank across multiple lines with single line breaks
I can use the following to yank text inside of quotes across multiple lines, separate that text by a single new line, and be able to paste it characterwise.
let @q = '' | *g/^/exe 'norm! "Qyi&...
1
vote
4
answers
47
views
Rotate list of lines
Assume you have the following block of text (yes: I am using vim-latex, but this is not relevant):
\begin{itemize}
\item 1
% [[[
\item 2
\item 3
\item 4
\item 5
% ]]]
\item 6
\end{itemize}
My ...
1
vote
2
answers
106
views
Yank current line range
I would like to yank the current selected line range (not the line range content).
For example, if my selection goes from line 51 to 67, I looking for a way to yank 51,67 to my default register.
0
votes
4
answers
104
views
How to paste Vim (normal mode) commands?
I need to copy a sequence of (normal mode) commands and then paste it to be executed in Vim.
When I try that now though it inserts it for me into the document.
How can I paste sequence of Vim (normal ...
1
vote
0
answers
69
views
Pasting into vim over ssh repeats or drops 6 characters at random
When I SSH into a remote Ubuntu container on a particular system and open vim, I cannot paste consistently. Say I copy the string abcdefghijklmnopqrstuvwxyz to my clipboard. If I open vim, enter ...
4
votes
1
answer
433
views
Why does `yW` yank until the end of the WORD, but `W` move to the next one?
My confusion started with realizing, that yW yanks a different region, then what vW selects, but I found this that explains about selection. But then I realized, that while yW will yank until the end ...
1
vote
3
answers
87
views
Block select unequal lines
I often have code of the form:
money = double(123)
user_level = user["level"]
timer = get_time()
and want to have:
money = double(123)
user_level = user["level"...
0
votes
2
answers
34
views
Retain externally copied text when yanking
I've got clipboard=unnamed which means that when I copy from somewhere outside Vim, I can just "put" it into Vim without any additional thought. Most is the time this is perfectly adequate.
...
0
votes
0
answers
80
views
Behavior of copy/paste with system register + has suddenly changed
(Vim version and system info follows at bottom)
Never had any problems copying to the system register with "+y before, nor pasting from that register into another application or into a terminal. ...
0
votes
3
answers
369
views
Why Y doesn't work like `yy`, but works like `y$`?
Why Y command doesn't work like yy, but works like y$? I mean, everyone says that it does work like yy, but for me, it doesn't. So how do I fix it?
For the close reason: This question doesn't help me. ...
1
vote
3
answers
342
views
How to print yanked data in replace mode?
I want to paste data from clipboard. But instead of insert the data, I want to overwrite (like using R).
1
vote
1
answer
213
views
What does the little character 'a' (`ª`) mean when pasting text?
I'm very new to Vim. I use Vim in PowerShell on Windows 11. On normal mode I press p to paste a text, but instead only this character ª shows up. What does this mean?
Typing "*p: or :reg " ...
5
votes
0
answers
532
views
How to copy to system clipboard using Mosh + Tmux?
I've set vim.opt.clipboard = "unnamedplus" to copy to/paste from the system clipboard. However, I noticed that the behavior differs whether I'm using nvim in my local machine, a remote ...
1
vote
1
answer
140
views
Vim has Erroneous Behavior on paste?
This honestly might be a bug. But sometimes when I am pasting into vim (on insert mode, using CMD+V), it just pastes some partial output of what I had copied and does extra things like deleting ...
0
votes
1
answer
280
views
Paste from WSL to gVim running under WSL add carriage return (CR / ^M) to the end of all pasted lines
Using WSL2/WSLg and Ubuntu 22.04 LTS under it, with gVim running and has a Linux file opened (i.e. with LF endings only), when I paste text from Windows into gVim, all the lines pasted have the CR/^M ...
1
vote
3
answers
383
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 ...
0
votes
1
answer
1k
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. ...
6
votes
1
answer
2k
views
What's the difference between d, and x?
What's the difference between d and x?
As per my cheatsheet, the definition says
x Delete characters after cursor
d Cut but remain in normal mode
I dont know because i'm new to vim
0
votes
0
answers
52
views
Why does <esc> on empty, indented line, jump to beginning?
I'm trying to do something very simple, enter normal mode and ALWAYS be able to somehow put the normal mode cursor where it was in insert mode, whether through a mark, or otherwise.
I'm doing this ...
2
votes
2
answers
207
views
How to replace till the end of the line without joining lines?
One of the main usage I have for selection is replacement.
Suppose I have:
Jane: Hello foo1 & bar1
John: Hello
Jane: Hello foo2 and bar2
John: Hello
Jane: Hello foo3 or bar3
John: Hello
That I ...
3
votes
2
answers
248
views
Vim yank from cursor position to end of nth line
I am trying to yank from my cursor posintion to end of nth line defined by a motion. So for the below text
Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Donec non quam et erat pharetra
...
0
votes
3
answers
340
views
Paste in visual block mode without deleting the character under vertically multiple cursor
When I want to paste some text after selecting vertically with <C-q>
It is known that Vim/gVim will replace the character under the cursor. For example, below is shown the result after pasting ...
0
votes
2
answers
239
views
Is there a way in Vim to paste a line so it pushes the current line down?
The default pasting behavior in vim is to put the line directly below the cursor. Pasting "Line 2" on "Line 1" results like this:
Line 1
Line 2
Line 1
Line 2
Is it possible to ...
10
votes
4
answers
5k
views
How can I delete in Vim all text from current cursor position to the end of file without using End key?
Is there any other possibility to delete from the current cursor position till end of the file without using the End keyboard key?
I know that I can perform it with d<CTRL-End> but perhaps is ...
0
votes
0
answers
335
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 ...
3
votes
3
answers
5k
views
NeoVim: Following the instructions in ":h clipboard-wsl" not work? It shows "no provider" but also "ok" in ":checkhealth"?
I am using neovim on archlinux/WSL2, and try to communicate with the Windows clipboard in neovim.
Following the instructions in :h clipboard-wsl, I filled in init.lua with code:
vim.g.clipboard = {
...
1
vote
1
answer
84
views
How to yank while in visual mode without showing message?
When I'm in visual mode and I yank the selection (which has at least 3 lines), messages like these are shown:
4 lines yanked
block of 4 lines yanked
How can I suppress this so it won't appear in :...
0
votes
0
answers
149
views
How to search for yanked text in a macro?
How do I search for yanked text in a macro properly?
I tried the following:
qq (start a macro)
yi" (yank text inbetween ", let's say the yanked text is foo)
/
press ctrl + r
" (I ...
1
vote
0
answers
179
views
How to override neovim paste implementation?
I wanted to add some handler that is triggered whenever a paste happened. From what I know, there is no such a thing like autocmd for paste action. I have look into some possible solution such as ...
1
vote
1
answer
179
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 ...
5
votes
2
answers
2k
views
Replacing text with a visual block
Here is what I want to do. Consider the text
abcvvxyz
abcvvxyz
123456
123456
I would like to copy the v block and paste it over the 45 block to get the following:
abcvvxyz
abcvvxyz
123vv6
123vv6
...
0
votes
0
answers
61
views
What's controlling Vim paste behaviour?
What's controlling Vim paste behaviour via Vim over ssh using putty with right-click paste set to Linux host?
To start we have:
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 27 2023 00:00:00)
...
3
votes
1
answer
458
views
How to yank without a buffer?
Does any kind of :call yank(register_name, "string") API exist in vim? Or at least :yank register_name "strings" - I can't find any way to yank in vimscript without modifying a VIM ...