Skip to content

Ignore doc/tags #6

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

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/doc/tags
18 changes: 12 additions & 6 deletions doc/yankring.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ variables in your |vimrc|.

The YankRing plugin uses the yankring_n_keys global variable to create
a number of defaults maps. The maps are of the form: >
nnoremap Y :<C-U>YRYankCount 'Y'<CR>
nnoremap Y Y<SNR>_yrrecord
<
When capital Y is pressed, the YankRing will execute 'Y' and capture the
output from Vim. But there are cases where you do not want the default
Expand All @@ -507,14 +507,20 @@ function called YRRunAfterMaps() exists. If it does, it will call
this function after it has created the maps. So in my case, I created
the following function in my |vimrc|: >
function! YRRunAfterMaps()
nnoremap Y :<C-U>YRYankCount 'y$'<CR>
call YRnmap('Y', 'y$')
endfunction
<
You can do anything you need in this function. >
nnoremap Y :<C-U>YRYankCount 'y$'<CR>
<
This line remaps Y (which the user presses) to the YRYankCount command. The
YRYankCount tells Vim to execute y$ instead.

Use YRnmap() to customize normal mappings. Example: map Y to y$:

call YRnmap('Y', 'y$')

It remaps Y to y$ and tells YankRing to update its history.

Use YRomap() to customize operator mappings. Example: map H to ^:

call YRomap('H', '^')

3.4 Customizing Menus *yankring-custom-menus*

Expand Down
9 changes: 9 additions & 0 deletions plugin/yankring.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,15 @@ function! s:YRMapsMacro(bang, ...)
call s:YRMapsCreate('add_only_zap_keys')
endfunction

" For customization in YRRunAfterMaps().
function YRomap(from, to)
exec 'omap <expr>' a:from 'YRMapsExpression("<SID>", "'. escape(a:to, '\"'). '")'
endfunction

" For customization in YRRunAfterMaps().
function YRnmap(from, to)
exec 'nmap' a:from a:to."<SID>yrrecord"
endfunction

" Create the default maps
function! s:YRMapsCreate(...)
Expand Down