maxbrunsfeld / vim-yankstack

A lightweight implementation of emacs's kill-ring for vim
437 stars 29 forks source link

After setup callback #60

Open iamFIREcracker opened 7 years ago

iamFIREcracker commented 7 years ago

This PR adds support for a user defined function that yankstack will run after the initial setup.

I recently switched from pathogen to Vim's built-in support for plugins, and noticed that calling yankstack#setup() to get custom mappings set up did not work anymore; it turns out I have to throw a packloadall somewhere in my vimrc, but that breaks other things.

So I thought: why not let the user know when the initial setup is complete? I could then add the following to my vimrc, and call it a day:

function! YankStackAfterSetup()
    nmap Y y$
    nmap D d$
    nmap gp <Plug>yankstack_substitute_older_paste
    nmap gP <Plug>yankstack_substitute_newer_paste
endfunction

let g:yankstack_after_setup = 'YankStackAfterSetup'

What do you think about that? Can you think of a better way to solve this?

Ciao, Matteo