Permalink
Browse files

Version 1.11: ENH: Support repetition of mappings through repeat.vim.

  • Loading branch information...
1 parent d123517 commit 8a24b5248b8cbaabb7a713749921cd4b7cab8381 Ingo Karkat committed with Jun 7, 2011
Showing with 18 additions and 9 deletions.
  1. +2 −2 README
  2. +7 −3 doc/UnconditionalPaste.txt
  3. +9 −4 plugin/UnconditionalPaste.vim
View
@@ -3,8 +3,8 @@ This is a mirror of http://www.vim.org/scripts/script.php?script_id=3355
DESCRIPTION
If you're like me, you occasionally do a linewise yank, and then want to
insert that yanked text in the middle of some other line (or vice versa).
-The mappings defined by this plugin will allow you to do a linewise or
-characterwise paste no matter how you yanked the text.
+The mappings defined by this plugin will allow you to do a character-, line-,
+or block-wise paste no matter how you yanked the text.
SOURCE
Based on vimtip #1199 by cory,
@@ -1,4 +1,4 @@
-*UnconditionalPaste.txt* Force linewise or characterwise paste.
+*UnconditionalPaste.txt* Force character-/line-/block-wise paste, regardless of how it was yanked.
UNCONDITIONAL PASTE by Ingo Karkat
*UnconditionalPaste.vim*
@@ -16,8 +16,8 @@ DESCRIPTION *UnconditionalPaste-description*
If you're like me, you occasionally do a linewise yank, and then want to
insert that yanked text in the middle of some other line (or vice versa).
-The mappings defined by this plugin will allow you to do a linewise or
-characterwise paste no matter how you yanked the text.
+The mappings defined by this plugin will allow you to do a character-, line-,
+or block-wise paste no matter how you yanked the text.
SOURCE *
@@ -50,6 +50,7 @@ To uninstall, use the |:RmVimball| command.
DEPENDENCIES *UnconditionalPaste-dependencies*
- Requires Vim 7.0 or higher.
+- vimscript #2136 repeat.vim autoload script (optional).
==============================================================================
CONFIGURATION *UnconditionalPaste-configuration*
@@ -76,6 +77,9 @@ IDEAS *UnconditionalPaste-ideas*
==============================================================================
HISTORY *UnconditionalPaste-history*
+1.11 06-Jun-2011
+ENH: Support repetition of mappings through repeat.vim.
+
1.10 12-Jan-2011
Incorporated suggestions by Peter Rincker (thanks for the patch!):
- Made mappings configurable via the customary <Plug> mappings.
@@ -1,8 +1,9 @@
-" UnconditionalPaste.vim: Force linewise or characterwise paste, regardless of
+" UnconditionalPaste.vim: Force character-/line-/block-wise paste, regardless of
" how it was yanked.
"
" DEPENDENCIES:
" - Requires Vim 7.0 or higher.
+" - repeat.vim (vimscript #2136) autoload script (optional).
" Copyright: (C) 2006-2011 Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
@@ -12,6 +13,8 @@
" http://vim.wikia.com/wiki/Unconditional_linewise_or_characterwise_paste
"
" REVISION DATE REMARKS
+" 1.11.010 06-Jun-2011 ENH: Support repetition of mappings through
+" repeat.vim.
" 1.10.009 12-Jan-2011 Incorporated suggestions by Peter Rincker
" (thanks for the patch!):
" Made mappings configurable via the customary
@@ -76,11 +79,13 @@ endfunction
function! s:CreateMappings()
for [l:pasteName, pasteType] in [['Char', 'c'], ['Line', 'l'], ['Block', 'b']]
for [l:direction, l:pasteCmd] in [['After', 'p'], ['Before', 'P']]
- let l:plugMappingName = '<Plug>UnconditionalPaste' . l:pasteName . l:direction
- execute printf('nnoremap %s :<C-u>call <SID>Paste(v:register, %s, %s)<CR>',
+ let l:mappingName = 'UnconditionalPaste' . l:pasteName . l:direction
+ let l:plugMappingName = '<Plug>' . l:mappingName
+ execute printf('nnoremap %s :<C-u>call <SID>Paste(v:register, %s, %s)<Bar>silent! call repeat#set("\<lt>Plug>%s")<CR>',
\ l:plugMappingName,
\ string(l:pasteType),
- \ string(l:pasteCmd)
+ \ string(l:pasteCmd),
+ \ l:mappingName
\)
if ! hasmapto(l:plugMappingName, 'n')
execute printf('nmap <silent> g%s%s %s',

0 comments on commit 8a24b52

Please sign in to comment.