From a71fcfe8138b92acbe93f36c34931e12217741b7 Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Sat, 7 Oct 2017 16:34:19 +0100 Subject: [PATCH 1/2] Add 'g:yankstack_after_setup' --- README.md | 13 +++++++++++++ autoload/yankstack.vim | 4 ++++ doc/yankstack.txt | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/README.md b/README.md index 2fcfc76..ffcd404 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,17 @@ nmap Y y$ " other mappings involving y, d, c, etc ``` +Alternatively, if you can't afford to call 'yankstack#setup()' too early in +your |vimrc| you can still tell yankstack to call a user defined function when +the initial setup has run: + +``` +function! YankStackAfterSetup() + nmap Y y$ +endfunction +let g:yankstack_after_setup = 'YankStackAfterSetup' +``` + You can also prevent certain keys from being remapped by setting the `g:yankstack_yank_keys` to the keys of your choosing. For example, if you only want Yankstack to remap `y` and `d`: @@ -94,6 +105,8 @@ Check it out on [github](https://github.com/maxbrunsfeld/vim-yankstack)! ## Changelog ## +### 1.0.7 (2017-10-07) + - Allow function to be executed after initial setup has run. ### 1.0.6 (2014-08-04) - Allow customization of the list of keys to be remapped. diff --git a/autoload/yankstack.vim b/autoload/yankstack.vim index 8feb49e..0c68fdc 100644 --- a/autoload/yankstack.vim +++ b/autoload/yankstack.vim @@ -173,6 +173,10 @@ function! yankstack#setup() for key in word_characters exec 'smap ' key 'yank_with_key("' . key . '")' endfor + + if exists('g:yankstack_after_setup') + exec 'call '.g:yankstack_after_setup.'()' + endif endfunction nnoremap yankstack_substitute_older_paste :call substitute_paste(v:count1, 'n') diff --git a/doc/yankstack.txt b/doc/yankstack.txt index 2a7dee5..c5c50f1 100644 --- a/doc/yankstack.txt +++ b/doc/yankstack.txt @@ -86,8 +86,20 @@ mappings of your own. To achieve this, just call 'yankstack#setup()'in your call yankstack#setup() nmap Y y$ +Alternatively, if you can't afford to call 'yankstack#setup()' too early in +your |vimrc| you can still tell yankstack to call a user defined function when +the initial setup has run: + + function! YankStackAfterSetup() + nmap Y y$ + endfunction + let g:yankstack_after_setup = 'YankStackAfterSetup' + CHANGELOG *yankstack-changelog* +1.0.7 (2017-10-07) + - Allow function to be executed after initial setup has run. + 1.0.5 (2012-07-19) - Fix bug where on certain versions of vim, the first time you tried to cycle through your yanks after doing a normal paste, an extra From b3fc5f5e5754185f414bd57aa0c6c196e4aeca94 Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Sat, 7 Oct 2017 16:34:47 +0100 Subject: [PATCH 2/2] Sync doc/readme changelogs --- doc/yankstack.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/yankstack.txt b/doc/yankstack.txt index c5c50f1..53cec95 100644 --- a/doc/yankstack.txt +++ b/doc/yankstack.txt @@ -100,6 +100,9 @@ CHANGELOG *yankstack-changelog* 1.0.7 (2017-10-07) - Allow function to be executed after initial setup has run. +1.0.6 (2014-08-04) + - Allow customization of the list of keys to be remapped. + 1.0.5 (2012-07-19) - Fix bug where on certain versions of vim, the first time you tried to cycle through your yanks after doing a normal paste, an extra