Questions tagged [yank]

Emacs' name for 'paste' (the one that goes together with copy).

Yanking means reinserting text previously killed. The usual way to move or copy text is to kill it and then yank it elsewhere.

  • C-y:Yank the last kill into the buffer, at point (yank).
  • M-y: Replace the text just yanked with an earlier batch of killed text (yank-pop).

(from the Emacs manual)

79 questions
21
votes
1 answer

evil-mode visual selection copies text to clipboard automatically

Setup: GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL Compiled from EmacsW64. Package Evil, using the latest version of Evil from MELPA Windows 7 x64 bit. Situation: Tested with empty Emacs configuration with only Evil…
ReneFroger
  • 3,855
  • 22
  • 63
14
votes
3 answers

What is the origin of the term "yank"?

I'm interested in learning how the term "yank" got its name. I'm also interested in why Emacs "yank" differs from vi/vim "yank". See also: dual question about Vi, also on Unix & Linux;
kliph
  • 143
  • 4
12
votes
4 answers

How do I yank and cycle backward through earlier killed text?

Emacs has this very handy kill-ring that can be cycled through after yanking, by pressing M-y repeatedly. Is there a way to switch the cycling direction? So I don not need to cycle through all when I actually want to get to the very first one?
stevosn
  • 291
  • 2
  • 8
9
votes
2 answers

How to overwrite a copied rectangle instead of inserting it (which is the default behavior of yank-rectangle)?

After copying a "rectangle" using C-x r M-w, doing C-x r y yanks or pastes the rectangle. But that inserts the copied rectangle. How can I paste the copied rectangle so that it overwrites the text? Example: a b c d e f g h i j k▮l m n o p q r s t…
Kaushal Modi
  • 25,203
  • 3
  • 74
  • 179
9
votes
4 answers

In Evil mode, how can I prevent adding to the kill ring when I yank text, visual mode over other text, then paste over?

If I have text1 text2, I yank text1 with yw then I highlight text2 with vw and paste overwrite that text with p, my kill ring now has text2. I'd prefer if text2 wasn't added to my kill ring because next time I paste text, Emacs will paste text2…
irregular
  • 962
  • 1
  • 9
  • 21
9
votes
3 answers

How to push system clipboards to kill ring contents at real-time when I copy outside emacs?

I noticed that when I copy thing outside of Emacs, the thing does not appear to kill ring immediately except I yank it to Emacs. If I copy twice, only the last copy can be got by yank. Sometimes, I would like to push the copys from system…
Leu_Grady
  • 2,420
  • 1
  • 17
  • 27
8
votes
4 answers

Fastest way to move code block to specific line

Say you have code on lines 4, 5, 6. Then you want to move this block of code to starting point line 9 while also deleting lines 4, 5, 6. What's the fastest way, i.e. least amount of key strokes, to achieve this? Would a custom function be better…
c-o-d
  • 910
  • 9
  • 19
8
votes
3 answers

Use avy to select distant word or line and paste at point

Is there a way to use avy or a similar in-buffer selection tool to quickly select a word or line to paste at the current point? For the following buffer an example workflow for proposed functionality would be: line 1 - reallyLongSymbol line 2 -…
Joe
  • 1,312
  • 1
  • 8
  • 19
8
votes
2 answers

Insert lines when yanking rectangle rather than inserting among following lines?

Having copied the 3x3 rectangular region containing a's, how can I yank/paste that content at the desired point without slicing into the following text? The following is the behavior for: M-w (kill-ring-save), M-y…
ebpa
  • 7,319
  • 26
  • 53
8
votes
2 answers

Yank a column of text copied from the clipboard

I often seem to want to copy paste multiple columns, for example, I paste one column line one line two line three Now I'd like to be able to yank another column behind it. Assuming my kill buffer has the following: added to one added to two added…
hbogert
  • 191
  • 1
  • 6
7
votes
1 answer

Copy and paste to system clipboard in tmux

I have the following code in my init.el (xclip-mode +1) (setq x-select-enable-clipboard t x-select-enable-primary t x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) x-stretch-cursor t) In a regular terminal, copy and paste…
PythonNut
  • 10,243
  • 2
  • 29
  • 75
7
votes
1 answer

How to stop web-mode from reindenting after yank?

I'm editing this code: callFunction({ x: somearray, }); Then I want to extract somearray to be a variable with a copy. I cut somearray and delete the colon, then enter (_ is the cursor): const x = [..._ callFunction({ x }); Then yank, and…
Arry
  • 203
  • 1
  • 3
7
votes
4 answers

How can I copy syntax highlighted code as RTF or HTML?

I'm using Emacs to write code samples that I later want to be able to paste into a MS-Word document, preserving the syntax highlighting. I understand that in order to do this I need to copy the text in either RTF or HTML format. Currently I'm just…
xlbloke
  • 71
  • 1
  • 3
6
votes
2 answers

How to automatically adjust whitespace after yanks?

When editing human language text and moving text fragments around, I frequently run into the problem that whitespace moved at the beginning or end of a fragment doesn't fit into the new position. For example, consider this paragraph: This is the…
Torsten Bronger
  • 329
  • 2
  • 6
5
votes
3 answers

Removing unwanted colors (and other decorations) from yanked text

I have a Java properties file that, when opened with Emacs, shows up in a color coded form, as below: I also have a simple text file. When I yank something from the properties file into the text file, the font colors are yanked along with the…
Chrisuu
  • 169
  • 6
1
2 3 4 5 6