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
245 views

Issue with paste command remap in vim

I want to auto indent code on pasting and found this: :nnoremap p p=`] --(not working) but it was not working for me as the code still came out unindented. So I used: :nnoremap &...
0
votes
1answer
34 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?
0
votes
3answers
404 views

Is it possible to yank a column of text in vim without visual block mode?

Consider the following text file. 1 1 3 1 1 5 One can rank row 1 with the command y$ with the cursor on row 1, column 1. However, to yank the first column, the only way I know is to <C-v>3jy. ...
0
votes
2answers
42 views

How omit text between and including matching characters?

If I have a text containing markdown matching markings e.g. "Strikethrough uses two tildes. ~~Scratch this.~~" What would be a good way to delete all those occurrences such as - in this example - "~...
0
votes
1answer
63 views

How to operate on all of a word without its surrounding space?

In vim you can do daw to delete the entire word, but it also removes the space after the word, (caw too). Is there a way to operate on the entire word without effecting the space around it? For ...
0
votes
1answer
48 views

Save view after execute command?

I'm mostly developing with python. I'm using pdbpp as python debugger so I'm contantly adding import pdb;pdb.set_trace() or import pdb pdb.set_trace() So I wrote couple of functions. function! ...
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 ...
0
votes
2answers
1k 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 ...
0
votes
1answer
25 views

How do I delete the end-of-line to the right of my cursor?

Say I have the following text open in vi: Lorem Ipsum is simply dummy text [CURSOR] of the printing and ... The cursor position is denoted by [CURSOR] How can I delete the end-of-line that follows ...
0
votes
1answer
125 views

Copy and paste with breakindent set

I'm using breakindent to make long lines wraparound to the same indentation level as the start of the line. Unfortunately, with this setting on system copy and paste (in this case, out of the macOS ...
0
votes
2answers
94 views

How to yank a specified amount of lines in vim -E mode?

This is my first-post and question here so please be gentle (but also tell me if, it I wasn't specific enough etc...) So my questions seems rather simple to me, but still blocks me and I can't find ...
0
votes
1answer
84 views

How to delete Chinese characters in Lisp code (solved)

EDIT. Cause of problem has been found: the problem only appears when Tamas Kovacs' Paredit plugin is enabled. I have a lisp file containing comments and strings written using Chinese chracters. The ...
0
votes
1answer
40 views

Unable to copy line with .co

Since dot (.) is the range indicator for the current line I was expecting :.co to copy the current line, but it does not do this. What am I doing wrong? In contrast :.w my_line.txt will write the ...
0
votes
1answer
32 views

Yank-in-word with indentation: Get/set buffer position, manipulate yank buffer

I am trying to write a command that yanks the whitespace (indentation) at the start of a line as well as yanking some other object. I have several ideas of how this could be done. Consider the ...
0
votes
2answers
190 views

Strangely slow key bindings

I defined these maps, to yank into system clipboard. noremap <leader>y "*y noremap <leader>Y "*Y noremap <leader>yy "*yy But when I use the first one (<leader>y), I find it ...
0
votes
1answer
299 views

Can't map to <C-Insert>

I'm trying to use ac to copy the whole contents to the system clipboard in gVim. Putting this in my .vimrc isn't working: nnoremap <leader>ac ggvG$<C-Insert> If I manually press ggvG$[...
0
votes
2answers
103 views

How to paste a line inside another line ? i.e. How to paste a line as words?

I would like to easily transform these two lines : One line. long line with many words in this example into the line : One long line with many words in this example line. How I currently do ...
0
votes
1answer
28 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 ...
0
votes
1answer
41 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....
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}, ...
0
votes
1answer
29 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
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
90 views

Multiline paste with relative columns alignment

When I have some text indented as follows (like a and b variables assignment): if(condition) a = 1; b = 2; end and I want to paste a and b block somewhere outside of the if block, i.e just ...
0
votes
2answers
130 views

How to copy file and line info from vim to gdb?

For setting breakpoints, I was wondering if there is any way to copy the location of a line in a file opened in vim, to gdb rather than typing the whole file path and linenumber in the gdb shell?
0
votes
1answer
64 views

How does deleting words with `d[number]w` work?

If my cursor is between the words "because" and "and" in the following text, typing d2w in command mode deletes everything in between "because" and "su without". because and su without After ...
0
votes
1answer
52 views

How to copy up to the cursor without including the charater under the cursor

Like you would in virtually any application editing text. For example: this is a big sentence so I can explain ^ ^ start of selection my cursor is here I'd like to ...
0
votes
1answer
50 views

How to copy content in + register from local vim to remote vim in good format?

vim1 is my local vim.vim2 is the remote vim. ssh root@remote_ip vim #it is vim2 Now some content in my vim1's + register. curl -X POST https://content.dropboxapi.com/2/files/upload \ --...
0
votes
1answer
254 views

Cut a regex matching line and paste it at another line

I am trying to edit a json file, and I need to take out the lines starting and ending with {% and %} respectively and move them to the beginning of the file. I need to do it at different places in a ...
0
votes
1answer
1k views

Copying to clipboard with clipboard=unnamed set

In the ~/.vimrc the clipboard has been enabled: set clipboard=unnamed But after hitting v for Visual and then hitting y (yank) then escape there is no contents in the clipboard. https://www....
0
votes
1answer
196 views

Copy a substring in line to the front of the line

I have a list of file names I'm trying to create insert statements out of. In each file name is the ID I need for the primary key, that I just need to copy from inside the file name to the front of ...
0
votes
1answer
75 views

Select several lines untill a specific symbol

I have the next lines of text in a file: eslint.vim flow.vim jscs.vim jshint.vim standard.vim xo.vim How can I yank names (without '.vim' part)? Even better would be to format it to look like this: ...
0
votes
1answer
84 views

More efficient way of yanking text out of tags?

<tspan x="0 0.54717 0.75472 1.32077 1.81134 2.35851 2.58493 3.13213.39625 3.96229 4.50947 ">Lincoln 30%</tspan> I have to yank the text between the tspan tags 32 times in a XML document....
0
votes
1answer
167 views

What does :[range]t <line-number> do?

I just started playing vimgolf and saw a solution that used this command to select a line and copy it to the line specified. I searched google and vim's documentation and couldn't find anything about ...
0
votes
2answers
752 views

Paragraph transfer from one file to another [closed]

Which commands can you use to take a paragraph from one file and insert it in a second file?
0
votes
1answer
84 views

accidental turn of mouse wheel when pasting text

A problem that bothers much my editing work with vim happens when pasting text and the mouse wheel rotates slightly by accident with the result that text is inserted elsewhere in the file under ...
0
votes
1answer
496 views

vi or vim: Mac/Iterm 2 highlight-paste [closed]

When editing with Vim on Macbook Pro with Iterm2 interface I can copy text by highlighting text with left-button double click on mouse, paste text by pressing center wheel on mouse. Instead of (2) I ...
0
votes
1answer
49 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
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 ...
0
votes
0answers
72 views

Move/copy range to start of current line

I just learned about the shortcuts that allow you to manipulate ranges, e.g. :+5,+10co. to copy after the current line. I wondered if there is a way to copy and move at the start of the current line? ...
0
votes
0answers
11 views

Artificial indenting with shift+insert [duplicate]

When I paste via SHIFT+INSERT, vim create artificial indent per line. How can I paste without any indenting?
0
votes
0answers
35 views

Quick paste via single keybind

As I understand, the default cursor looks like this: ▉ block. Currently I have these related settings: set guicursor=c-n-i-v:ver25-blinkoff0 And ver25 makes the cursor look and behave as if only ...
0
votes
0answers
134 views

Blockwise pasting from "+ register not working

UPDATE: I run an X server (XQuartz 2.7.11) on MacOS, which I forward via ssh to any Linux machine I use. The problem seems to be that under XQuartz, the "+ register does not support blockwise yanking/...
0
votes
1answer
150 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 ...
0
votes
1answer
783 views

How to yank string before a special character?

Example line: ^ some_string : other_string $. How to yank some_string before : without the spaces|tabs?
0
votes
1answer
133 views

Vim yank and paste via a shared file [duplicate]

I posted this question on StackOverflow first, as I did not know about "Vi and Vim beta". How to augment Vim yank and paste, so when I yank, Vim writes the content to a file? When I paste, it uses ...
-1
votes
1answer
76 views

How to copy and paste arguments into function parenthesis?

I constantly need to copy existing variable names or expressions as arguments for my current typing function: // int TyrionLannister; int JonSnow; ... int AryaStark; ... // int DaenerysTargaryen;...

1 2 3 4 5
6