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
0
votes
1answer
32 views

clipboard not activated

I installed vim from their github repo. But I cannot seem to copy paste with from the system clipboard. So, I explored a little and tried to install vim-gtk package which would enable the clipboard ...
1
vote
1answer
33 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 ...
0
votes
0answers
23 views

How to paste text from other applications into Vim without incrementally indenting each pasted line? [duplicate]

I want to copy text from other applications into Vim, e.g. from Visual Studio Code, but the result is awful. In particular, each pasted line is being indented incrementally: Furthermore, visually ...
1
vote
1answer
98 views

Yank multiple lines without using visual mode

I have the text: abcd abcd abcd abcd my cursor is in the first line, and I want to yank the first 2 lines. Usually I would do it by pressing Shift+v, selecting the second line by going down with j ...
0
votes
1answer
22 views

Grep for a pattern using current visual selection on another file

I want to basically search for a pattern in the current file on another file, from vim, using the current visual selection. I know doing: :grep pattern otherfile works, but i want the 'pattern' to be ...
1
vote
1answer
33 views

Vim filter command not using line-wise selection

I may have seen this question before on Vi Exchange but I'm having trouble locating it while searching now. If it's already been answered, please let me know the duplicate and I can find that. I have ...
1
vote
2answers
63 views

How can I paste text appending it to the end of each line? [duplicate]

If I have file1.txt which contains the following: Line 1.1; Line 1.2; Line 1.3; and file2.txt with the following Line 2.1; Line 2.2; Line 2.3; I want to copy all the lines of file2.txt and paste it ...
-1
votes
1answer
32 views

Put from register in insert mode?

Is there way to put from a generic register in insert mode? I found it time-wasting to switch between insert and normal mode while editing. Then I need to paste from the clipboard (copied from browser)...
1
vote
1answer
102 views

Custom g:clipboard results in `p` always pasting into the same line

Background I use wayland and neovim and when pasting external text it would add ^M to the end of each line. This is a known "bug" (https://github.com/neovim/neovim/issues/10223) and there ...
2
votes
1answer
39 views

Text get weird staircase indent on copy

I copied this file to vim and enumerated items got weird staircase pattern indent. Why so and how can I prevent this text corruption on a copy? It seems that it happens not only with enumerated items ...
3
votes
2answers
101 views

Vim not storing numbered registers

I've read that Vim automatically stores previously yanked texts into registers from 1 to 9, being 1 the previous yank, 2 the second previous, and so on... But this is not working for me. Here is a ...
2
votes
1answer
73 views

Date change question: Find and replace with wildcards?

I have a file with a bunch of dates of the form a/b/c, where a,b, and c are numbers of varying character length. However, I'd like to change every instance to read c/a/b. I'm wondering if there is a ...
0
votes
1answer
30 views

How can I make Neovim actually delete something instead of copy?

I find very frustrating in Neovim and vim that when I delete a text to replace it, what actually happens is that it copies the last thing I deleted. I've tried with this line in my init.vim: vnoremap ...
4
votes
0answers
52 views

How to exit insert mode if pressing escape merely types “^[”?

I have neovim 0.4.2 running in a session of kiTTY 0.17.4 on OSX. I have pasted a long url while in insert mode. After doing this, every time I type BKSPC vim adds ^? to my document. Every time I type ...
2
votes
1answer
48 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
50 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
47 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....
2
votes
1answer
52 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
29 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
96 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 ...
2
votes
3answers
280 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'...
0
votes
1answer
16 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
34 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
27 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
60 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 ...
1
vote
0answers
31 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 ...
0
votes
1answer
30 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
1answer
79 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
170 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 ...
3
votes
4answers
130 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 ...
1
vote
1answer
21 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
38 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
17 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 ...
1
vote
2answers
60 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
134 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
60 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 ...
0
votes
1answer
59 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. ...
0
votes
1answer
37 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
49 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", @")&...
2
votes
5answers
436 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
35 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 "...
2
votes
3answers
623 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 ...
2
votes
2answers
72 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
215 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 ...
1
vote
2answers
54 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-...
2
votes
3answers
154 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 = ...
0
votes
1answer
31 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 ...
0
votes
2answers
38 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 ...

1
2 3 4 5
7