VSCodeVim / VSCodeVim/Vim

Add Yankring Functionality

Open
#8,404 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/plugin
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Is your feature request related to a problem? Please describe.
Not a problem, just something I miss from Vim.

Describe the solution you'd like
When copying/pasting text in Vim, it's fairly common to yank some text, go to another spot in your code, delete something, then try to paste the original yank. However, the delete will overwrite the yanked text unless you explicitly yank to a register or use other workarounds. Yankring helps solve this problem by maintaining a history of the last X yanks and lets you quickly cycle through the list after pasting if the pasted text is not what you wanted.

Describe alternatives you've considered
It seems like there is already support for ReplaceWithRegister which can solve this problem if you're highlighting some text to replace it with yanked text, but I feel like this forces a workflow that isn't always ideal; I might realize I need to delete multiple things between the yank and the paste, for example, so I can't just highlight the text to be replaced.

Additional context
I'd love any feedback on how this might be accomplished. I'm not at all familiar with the VSCodeVim codebase, but I'd be willing to try my hand at implementing this if it seems feasible. I think the tricky bits are:

  1. Where do you store the yank history? I'm not sure how YankRing does this either tbh, whether it's using registers underneath or storing it in memory somewhere..., but it needs to intercept the normal yank command and be able to store the yanked text
  2. How to make it work without breaking existing functionality? In YankRing, the workflow is basically paste via p and then if that's not the text you were expecting you use a hotkey (i.e. ctrl+ p) to cycle through the YankRing history. This involves changing the most recently pasted item with the new item from YankRing, but I don't know if VSCode has "most recently pasted item" as a concept...

Obviously I'd love to know about any other tricky bits here that I'm not aware of!

Thanks for your time!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating the existing yank, register, delete, and paste handling, then review the linked YankRing and ReplaceWithRegister projects for relevant behavior. Done would mean a defined approach and support for preserving yank history and cycling through it after pasting.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.