Questions tagged [yank]

yanking is the older word for copying a line to a clipboard. Use this tag to ask about how the command is working, or advanced combinations.

yanking is the older word for copying a line to a clipboard. This is favoured in UNIX text editors such as and . Use this tag to ask about how the command is working, or advanced combinations/commands which involve yanking several lines.

68 questions
3
votes
1 answer

vim: strange issue when I yank a block with execute command

Good Morning, I have a strange issue when I yank a block with execute command. I have created a small file with a few lines for testing jkl; ;lkj jkl; ;lkj jkl; ;lkj jkl; ;lkj jkl; ;lkj jkl; ;lkj jkl; ;lkj jkl; ;lkj jkl; ;lkj jkl; ;lkj Ok it's not…
SierraX
  • 41
  • 3
3
votes
2 answers

How to fix a RubyGems.org project page after yanking a gem?

I have a gem published here: https://rubygems.org/gems/rangy-rails/ When I first released it in March 2013 I later realized that I had set an incorrect version. I immediately yanked the gem and resubmitted it with the correct version. Unfortunately…
Mario Zigliotto
  • 8,315
  • 7
  • 52
  • 71
3
votes
3 answers

How to yank the current line and the line above it in Vim?

What I need is to yank the current line and the line just above it. For instance, in the following example: 3 My test line 4 Line above current line 5 My current line |(cursor) 6 Line below current line How do I yank lines 5 and 4 when my…
RanRag
  • 48,359
  • 38
  • 114
  • 167
2
votes
1 answer

Same registers for different VIM tabs

I'm trying to make a copy paste from 1 file I have opened in a tab to another file I have opened in another tab. So I use the visual block to get my selection, yank it, but when I switch to other tab, it doesn't paste, it says: Nothing to…
JTL
  • 21
  • 1
2
votes
1 answer

Yank whole file

I would like to setup a command to yank the whole file without moving the cursor. Here is the macro I created: qaggVGy However, this moves the cursor to the beginning of the file. How can I yank the whole file without losing the cursors position ?
edi9999
  • 19,701
  • 13
  • 88
  • 127
2
votes
2 answers

Pasting text in vim. A tedious operation?

I've been using vim for somewhat longer than a year now and during this time I have never feel really comfortable with the way vim works with yanking and pasting text (or maybe it is just me not using it in the most efficient way) For example, I…
1
vote
1 answer

Vim: Yank selected text into buffer and overwrite that buffer

I'm yank-ing occurrences of MyText into a buffer B: :g/MyText/yank B But it always appends to the buffer instead of overwriting it. After a while the B register contains all the lines I've yanked previously. How can I overwrite it instead of…
Jin
  • 778
  • 1
  • 8
  • 23
1
vote
1 answer

How can I yank multiple lines in Neovim v0.6.x?

I want to yank the selected line in visual mode in Neovim v0.6.0. In Neovim v0.5.0 and Vim, I use "Y" in visual mode to achieve this. However, due to the following changes in neovim v0.6.0, the behavior of "Y" has changed and this method is no…
heptaliane
  • 13
  • 3
1
vote
2 answers

Why does yyp not behave according to p's documentation

I was just wondering if someone could explain what goes on behind the scenes w.r.t the behaviour of yyp. Given some text: Text that can be copied typing yyp while the cursor is in the middle of a line, let's say just before can, results in: Text…
t_von_doom
  • 21
  • 3
1
vote
1 answer

CLIPBOARD and PRIMARY registers don't work on my Linux

If I want to copy/paste something to/from a register I have no problem. For example if I'm in Visual Mode and I press "ay the selected region get correctly copied to register a (and if I press "ayy in Normal Mode, the line under the cursor get…
mugnozzo
  • 210
  • 1
  • 15
1
vote
2 answers

Re-bind VIM system clipboard register yank/paste keys

Instead of typing "*y "*p To copy code from one file to another, what kind of VIM shortcut would you guys recommend implementing in my .vimrc which won't interfere with many other motions?
kelemeno
  • 53
  • 5
1
vote
2 answers

delete/move/yank multiple sections vim

I'm aware that you can delete say lines 34-40 with :34,40d but is there a way to delete say lines 34-40 AND lines 43-45 something like :34,40(?)43,45d where (?) represents the symbol necessary to tell vim AND this second set of rows? Thanks
user642832
  • 21
  • 4
1
vote
1 answer

how to copy and paste a vim search result to a new tab

I trying to search and copy the matches within a limited scope in vim. as mentioned in this answer. I am trying to copy the result into a new vim tab using :'<,'>g/foo/y A but when a open a new tab :tabnew and try to paste p nothing is showing. 1.…
isnvi23h4
  • 1,910
  • 1
  • 27
  • 45
1
vote
1 answer

Vim: yank an entire environment of Tex file

I am using vim with latex-suite to edit my document and sometimes need to copy an entire environment (from \begin{...} to \end{...}). For example, I want to copy this part \begin{align*} \sigma &\rightarrow A | B | C | ABC \\ A &\rightarrow a |…
vad
  • 344
  • 2
  • 12
1
vote
1 answer

How can I copy the text from remote emacs to the local without hightlighting it?

Local: windows 7; Remote: Linux In putty, I use emacs -nw to write some code. When I want to copy into my local windows, I highlight it. But it shows with line number 15-|aaa 16-|BBB 17-|cccc So highlighting it doesn't work. Then I think using mark…
yuxuan
  • 417
  • 5
  • 16