Yank is more like Paste, instead of Copy. It uses its own buffer, instead of system-level clipboard.
Normal Case |
Compare to Kill-Yank Case in Sublime Text 3 / 4 |
Cut |
“Delete” as “Delete” in Delete {Line / to (Hard)BOL / to (Hard)EOL / to Mark}
|
Copy |
Add to Kill Ring |
Paste |
Yank |
Clipboard |
Own Buffer |
The only 4 cases
Talking based on the facts of Sublime Text 3 / 4, the only 4 cases where Yank is concerned are below functions (macros):
- Delete Line.
- Delete to (Hard)BOL, where BOL stands for beginning of line.
- Delete to (Hard)EOL, where EOL stands for end of line.
- Delete to Mark.
A separate “clipboard”
When you run the above commands, the target text is not just deleted. It is cut into a separate “clipboard”, different from the system-level one. Later when you run the Yank command, the text is pasted.
A little difference
A little difference is that if you consecutively run the Delete Line command for multiple times, the deleted lines will saved together. Later, when you run the Yank command to paste the text somewhere else, all the lines will be pasted together. By consecutively run I mean you do not change your cursor positions.
# step 1: run delete line consecutively for 3 times
> delete this line 1
> delete this line 2
> delete this line 3
...
# step 2: run yank and paste 3 lines at once
> line 1
> line 2
> line 3
Source
Use PackageResourceViewer to extract the Default package, where you’ll see that all I said above is from ~200 lines of the kill_ring.py
, mark.py
and several .sublime-macro
files.
Tech Review
Some of my personal viewpoints here. The Kill-Yank
is a half-complete feature in Sublime Text. It was introduced very early, trying to offer what Emacs does. This feature has potential, but no more official efforts were put on it from the official side, and it just stayed there.
For a good example, a full-fledged kill-ring is actually a ring that you can make use of, by e.g. yank-pop command. But the Sublime Text kill-ring is just a list of 16 separate slots, and nothing more was added to it.
But anyway, don’t bother. You already have Copy, Paste and Paste From History in Sublime Text.