Found out today that if you press Ctrl-Opt-Cmd-V in Textmate, it produces a cute little "chooser" dialogue in-place that allows you to page through your recent clipboard entries. It looks very similar to how CTRL-P and -N work in VIM, except it shows whole lines instead of simple word objects.

It seems like this would be doable in VIM — it already has a buffer full of entries (the YankRing buffer, for example), and it already has a chooser, but I can't think of where I'd look to start putting these two together. Any ideas?

(I know that YankRing already does this by opening a new window full of buffer content, but I wonder if there's a way to do it without all the window switching/closing/etc)


Vim provides two user-defined insert completion mechanisms: User defined completion and Omni completion. You can read about them here:

:help compl-function
:help compl-omni
:help complete-functions
:help 'completefunc'
:help 'omnifunc'

I've never used these myself, but since you asked for where to start looking, that's it. You may also want to read this section,

:help ins-completion

for an explanation of Vim's various built-in insert-mode completion mechanisms, which may help you avoid writing your own. I didn't see a predefined mechanism for selecting from clipboard entries, however. You can insert from previous deletions with a little work by using :registers to view the available registers and then inserting the contents of the desired register with Ctrl-R followed by the register name. See

:help :register
:help registers
:help i_CTRL-R
  • The "previous deletions" register is my biggest VIM complaint, because VIM throws everything I delete in there along with things I purposefully yank. Using :reg is pretty inefficient, so I've been using YankRing instead to simulate an emacs-like killring behavior. – Doug Avery Feb 25 '11 at 15:20

My answer is probably a bit OT but I prefer to have a system-wide clipboard manager as this functionality is useful in many contexts. Here are the ones I'm using with the exact same keyboard shortcut for each:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.