Vim icon indicating copy to clipboard operation
Vim copied to clipboard

clip-history extension support

Open Spirarel opened this issue 6 years ago • 4 comments

What is Clip-history?

Clip-history (also know as a yank-ring or kill-ring) is a feature that creates a small buffer of recently yanked, or copied, text. The buffer is then accessed with repeated presses of paste (or cmd+v), which cycle through the ring in a last-in, first-out manner, looping back to the first instance after viewing all entries in the buffer.

What does this solve?

Remembering and accessing paste buffers is a common pain-point in the vanilla vim experience. It has been addressed in vim with yank-ring, and in Atom's Vim-mode-plus with the excellent clip-history.

A relatable experience to many is needed to replace text within parenthesis with text previously outside. In vanilla vim yanking the desired text, then deleting the inner parenthesis text will replace the desired text in the default buffer. Ex:

function(props) {
    const ret = props.toggle ? 'why allocate' : 'here?'
    return(ret)
}

D on "props.tog...", followed by cib on "ret" will mean you have to specify the paste buffer, rather than just cycle through quickly with two presses of p.

Comments

While the above is a MWE, it's not uncommon to need to paste something a few deletions/changes back. Cycling through paste is highly visual and quick, offer more feedback than pasting from buffers. It's a great feature and I hope you guys think it's worthy of inclusion!

Spirarel avatar Aug 28 '19 03:08 Spirarel

Hi devs, I just found an extension with similar functionality: https://github.com/SrTobi/code-clip-ring/ . Are there any ways to integrate it into VSCodeVim?

Liu233w avatar Sep 06 '21 12:09 Liu233w

You can use my fork as a drop down support for kill ring support: https://marketplace.visualstudio.com/items?itemName=HyunggyuJang.vim-with-killring

HyunggyuJang avatar Nov 09 '23 05:11 HyunggyuJang

@HyunggyuJang I tried your fork out and it works great - any chance you could upstream it? (Since I'd like to have it on my other installations as well). Thanks!

nomoid avatar Jan 01 '24 08:01 nomoid

@nomoid Thanks for having an interest. I made a PR for this, see #8803

HyunggyuJang avatar Jan 01 '24 14:01 HyunggyuJang