Skip to content

After setup callback #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand All @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions autoload/yankstack.vim
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ function! yankstack#setup()
for key in word_characters
exec 'smap <expr>' key '<SID>yank_with_key("' . key . '")'
endfor

if exists('g:yankstack_after_setup')
exec 'call '.g:yankstack_after_setup.'()'
endif
endfunction

nnoremap <silent> <Plug>yankstack_substitute_older_paste :<C-u>call <SID>substitute_paste(v:count1, 'n')<CR>
Expand Down
15 changes: 15 additions & 0 deletions doc/yankstack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,23 @@ 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.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
Expand Down