Questions tagged [cut-copy-paste]

Questions about cutting, copying, and pasting text. In Vim, "cut" is also called "delete", "copy" is also called "yank", and "paste" is also called "put".

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

Yank visual selection with modifications in a terminal-buffer

Upon writing a code, sometimes I open a terminal split with :term to test it by issuing some commands and checking some output. As an example, this is a fragment of what I have executed in a split ...
3
votes
1answer
40 views

Append to current copy buffer

I am copying multiple lines from different parts. I can for example do 3yy to copy the 3 next lines. Then I would like to scroll a bit and add 5 more lines: 5yy and so on. At the end, I want to paste ...
0
votes
1answer
40 views

How to paste/merge 2 blocks of text in vim

I search a way to paste/merge 2 block of text block A apple pear banana block B tomato beans potato to this apple tomato pear beans banana potato I'm looking for an easy way to do this using macros....
1
vote
0answers
41 views

Can't Copy Non-ASCII Characters

I can't copy Non-ASCII charaters from Neovim anymore when I select them with mouse or crtl + v. For example, I have the Turkish word Bankası written in my editor. When I yank and paste it to somewhere ...
0
votes
2answers
28 views

How to delete strings to close quote and close parenthese

I have a code like this: h5 style=("text-align: center; margin-top: 2rem;") some text p style=("text-align: center; margin-top: 2rem;") some text And in first line, I want to ...
3
votes
3answers
89 views

Paste a block-copy into a single line

I need to restructure a markdown table, and for that, I wish there was a quick way to "join" lines from a multi-line cell. So with Vim, I would have to yank the block (Ctrl-v), and then ...
4
votes
5answers
170 views

Can I define something in .vimrc to speed up pasting of large amounts of data?

Occasionally, I paste large amounts of data into vim, using Ctrl+v in my terminal emulator (in Linux). This takes several seconds before vim is responsive again. I have tried two other methods, which ...
2
votes
3answers
275 views

Is there a quicker way to replace the content in parentheses with the content yanked?

If I want to replace something inside a group of parentheses (like say a function call) with something I've yanked I currently do: vi(p this obviously isn't an excessive use of the keyboard, however I'...
1
vote
1answer
16 views

Problem pasting text with brackets when using auto-close functions/plugins

It's nice to have an auto-close plugin for brackets and quotes like coc-pairs. However, when I paste text from outside into vim insert (ctrl-C, ctrl-shift-v), the text seems to be pasted character-by-...
0
votes
1answer
13 views

How to delete and replace a block of text with spaces?

What I want to do I want to select a block of text in Vim, delete it, and replace the selected block with spaces. Example Suppose I have the following text: Lorem ipsum dolor sit amet, ...
2
votes
0answers
32 views

Copy all text in Vi and then paste it to another application on another system

I connect to Linux server via SSH using Putty terminal. I open a file with Vim and press ggVGy in order to select all text and copy it. But when I try to paste the copied text to Windows Notepad, it ...
1
vote
1answer
19 views

How to paste yanked filename to other application?

I'm able to paste text to other application using CTRL + V. But when I try :let @" = expand("%:p"), then paste it to the other application it will just paste my last normal yanked text, instead the ...
1
vote
0answers
29 views

losing random chars when pasting (insert mode + :set paste are set)

When pasting a huge text (10,000 lines, around 500KB) in vim (yes, I'm using insert mode and :set paste), I lose random characters every few lines. I thought it could be a plugin, so I tried starting ...
1
vote
0answers
47 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 ...
0
votes
1answer
48 views

How can I put the system clipboard into a vim register?

Basically the opposite of this question. This is on macOS. I copy from a program using ⌘C and I want to add that text to "" or "0 so when I cw or something similar I don't obliterate my copied text. ...
356
votes
12answers
347k 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?
0
votes
1answer
29 views

Stop the normal mode delete commands from copying text

When editing text, I find it quite irritating that the normal mode commands, x, d and s all copy the text they remove. Don't we have y for copying? Perhaps I am "just doing it wrong", but for example ...
1
vote
2answers
138 views

Is visual model selection really faster than using mouse? [closed]

I am interested in finding the faster way to edit. My monitor is rotated 90 degrees vertically. When I code, I can see more lines than a typical monitor. I found that using mouse to select is faster ...
1
vote
1answer
55 views

How do I append to the unnamed register?

In particular, I'd like to append to the unnamed register with the :global command.
2
votes
2answers
111 views

How to activate bracketed paste mode in GNOME Terminal for Vim inside tmux

Edit this issue happens inside a tmux session. The original value of $TERM before starting vim is: echo $TERM screen The issue appears for example when pasting this kind of indented code: def ...
2
votes
4answers
107 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 ...
18
votes
4answers
9k views

How do I copy a file in netrw?

The current working directory is ./A/B/. An empty document is opened when I type vim, and the netrw is opened with command :e. The window is split by vs., and I can navigate to the upper level ...
0
votes
1answer
34 views

Yank once then multiple paste [duplicate]

My cursor is on line 10. How can I yank line 5 and paste to lines 10,20,30,40, and 50? I know :5 yank then navigate to each line and then P, how else can I do this?
1
vote
1answer
15 views

Set up a register backed by a file to fill in for xterm clipboard on a server without a display?

I used to use "+y and "+p in vim for copy pasting across vim instances. This also has the advantage that you can use "+ as a register for any command you know, including deletions etc. Now that I'm ...
32
votes
5answers
1k views

Is there a text object for the entire buffer?

I often find myself typing commands like gg"+yG or ggdG and would like a more efficient way to do this without having to move the cursor twice. Is there any command that I can use e.g. y[movement] to ...
1
vote
2answers
51 views

Why does <F22> appear when pasting into Vim?

I want to paste some text into Vim in GNOME Terminal on Ubuntu 20.04. Before doing that, I run: :set paste I use that so that autoindent and other Vim features don't change the text that I am ...
3
votes
1answer
132 views

How to copy paste one value and overwrite another

A common function I do in textmate or any other editor is copy some text and then paste it over some other text, for example: https://gyazo.com/fcef05504e83b608b583af085f92ecd2. Currently to copy a ...
1
vote
1answer
54 views

Can't copy special characters outside of vim

I'm using NVIM v0.4.3 with set clipboard=unnamed. I can insert special character like üäö in vim just fine, but if I copy content containing special characters in vim and try to paste them outside of ...
7
votes
6answers
13k views

how to delete all white spaces until first character?

Is there a simple way to delete all white spaces on a line until the first character on that line is met? An example: #a list of comments # item 1 # item 2 ...
1
vote
2answers
67 views

How to efficiently use the paste registers?

I often don't remember what was copied lately. So I don't know if I need to do <C-r>0 or <C-R>1 in insert mode. I tend to rely only on the * register, or type :reg, look at everything ...
0
votes
1answer
33 views

How to copy N words under cursor and to right of cursor?

How can I copy continue close current into buffer without getting into visual mode? That is, how to copy N words from cursor?
1
vote
1answer
40 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", @")&...
1
vote
4answers
331 views

How to delete a pair of parenthesis with backspace

I'm using vim to code C++ and I want to handle the parenthesis more easily. I knew that there was a plugin named Surround, which can help us but it is not what I expected. I set some shortcuts as ...
0
votes
0answers
21 views

Automating a yank and paste operation

If I want to copy and paste the next 5 lines and paste those 5 lines below the next 5 lines, I would do 5yy5jp. How would I use command to say something like 5yyp to paste the next 5 lines and ...
1
vote
1answer
31 views

Yank inside quotes of a range of lines to a register and separate them with a new line character

I would like to populate a register with the text inside quotes for a range of lines. The register should contain all yanked text separated with new line characters. Example lines: The "black" cat A "...
0
votes
1answer
149 views

IPython %cpaste command freezes in Terminal mode

I try to use IPython's %cpaste to paste the clipboard content (Python code) to my Terminal which is launched via Neovim's terminal mode. However, if I paste long lines of code, it freezes, and does ...
2
votes
3answers
579 views

Deleting without copying to clipboard in Windows?

Here is a typical workflow I would like to follow: copy some data from Excel spreadsheet into the clipboard in vim , delete the data in the file using ggdG then paste the data into the file from the ...
71
votes
5answers
72k views

How can I easily move a line?

What is the command (or shortcut) to move a line up or down in vim? My current workflow is to yank (copy) the line and than delete that line and than to put (paste) that line.
64
votes
4answers
28k views

How can I yank (copy) the single character on which the cursor rests?

I know many ways to copy things: yiw = yank in current word yaw = yank all word (includes a trailing space) yy = yank the current line 3yy = yank three lines starting at the current one yap = yank ...
2
votes
2answers
66 views

Search and copy the text between two markers in gvim

I want to copy strings that spans across multiple lines between two markers in a large file. In the below example file, start marker is <ROW> and end marker is </ROW>. <ROW> &...
0
votes
1answer
19 views

Delete to the end of a paragaph, including all of the current line

I'd like to redefine the { and } motions to operate "linewise" when used with the c and d operators. To be concrete, given the following: The quick brown fox j|umps over the lazy dog If I press d}, ...
1
vote
1answer
96 views

how to yank from vim to system clipboard?

I'm using the latest version of vim 8.2.148 on the latest version of arch linux 5.5.6-arch1-1 with the latest version of Openbox window manager version 3.6.1. I have written a document in vim and ...
2
votes
3answers
128 views

Delete specific character on previous line

I deleted lines in a file with :g/^\s*key3/d and now have a file like this: entry{entryname1, key1 = {text}, key2 = {text}, } entry{entryname2, anotherkey = {text}, yetanotherkey = ...
1
vote
2answers
47 views

Pasting text on Vim inside tmux breaks indentation

Ubuntu: 18.04 bionic tmux: version 2.6 VIM: Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 ) Included patches: 1-1453 Modified by pkg-vim-maintainers@lists.alioth.debian.org Compiled by pkg-vim-...
0
votes
2answers
37 views

Paste at cursor instead of below

If I start with this file: https://example.com <> and press ddp, I expect to get this: <https://example.com> but instead I get this: <> https://example.com What am I doing ...
0
votes
1answer
27 views

Normal mode Backspace and Delete

If I have a file like this in Insert Mode (pipe is cursor): Sunday | Monday I can press Backspace or Delete to remove the empty line. However in Normal Mode, neither of those work. I have been ...
3
votes
1answer
94 views

Is it possible to place marks at the end of a line?

Typical mark placement using m places the mark at the cursor. When the cursor is on the last character of a line, this means that jumping to that mark for the purpose of copying text starts the ...
1
vote
2answers
56 views

Yank multiple lines and paste at end of lines

I have 3 blocks of text with the same number of lines that I want to merge each block by line. # block 1 [ Card "Skwortul" , Card "Scorchander" , Card "Seedasaur" , Card "Kapichu" , Card ...
11
votes
6answers
4k views

Deleting In Vim and Then Pasting Without new Line

Many times in vim I would like to delete a line completely, so I use dd. However, I then need to paste that line into some other position within a line, but this inserts a newline before pasting, ...
5
votes
1answer
6k 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 ...

1
2 3 4 5 6