README 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. This is a mirror of http://www.vim.org/scripts/script.php?script_id=3848
  2. DESCRIPTION
  3. This plugin defines repetition of Vim built-in normal mode commands via .
  4. for visual mode. Additionally, it offers functions like the popular repeat.vim
  5. plugin that allow mappings to be repeated in visual mode, too.
  6. VISUAL MODE REPETITION
  7. This extends the built-in normal mode repeat . to visual mode.
  8. VISUAL MODE MAPPING REPETITION
  9. Like with repeat.vim for normal mode, visual mode mappings can register a
  10. <Plug> mapping to be used for visual mode repetition.
  11. Likewise, normal mode mappings can (in addition to the repeat.vim registration
  12. of a normal mode mapping) register a visual mode mapping with visualrepeat.vim
  13. that will be repeated in visual mode.
  14. Operator-pending mappings end with g@ and repeat naturally; i.e. Vim
  15. re-applies the 'opfunc' on the equivalent text (but at the current cursor
  16. position). But without a call to repeat#set(), it is impossible to repeat this
  17. operator-pending mapping to the current visual selection. Plugins cannot call
  18. repeat#set() in their operator-pending mapping, because then Vim's built-in
  19. repeat would be circumvented, the full mapping ending with g@ would be
  20. re-executed, and the repetition would then wait for the {motion}, what is not
  21. wanted.
  22. Therefore, this plugin offers a separate visualrepeat#set() function that can
  23. be invoked for operator-pending mappings. It can also be invoked for
  24. normal-mode mappings that have already called repeat#set(), and may override
  25. that mapping with a special repeat mapping for visual mode repeats. Together
  26. with the remapped {Visual}. command, this allows repetition - similar to what
  27. the built-in Vim commands do - across normal, operator-pending and visual
  28. mode.
  29. SOURCE
  30. - Based on vimtip #1142, Repeat last command and put cursor at start of change
  31. http://vim.wikia.com/wiki/Repeat_last_command_and_put_cursor_at_start_of_change
  32. - The client interface and implementation has been based on repeat.vim
  33. (vimscript #2136) by Tim Pope.
  34. RELATED WORKS
  35. - repeat.vim (vimscript #2136) has been the basis for this plugin and should
  36. be used in conjunction with visualrepeat.vim. (Otherwise, you'd have visual
  37. mode repeat, but no repeat in normal mode.)
  38. USAGE
  39. {Visual}. Repeat last change in all visually selected lines.
  40. - characterwise: Start from cursor position.
  41. - linewise: Each line separately, starting from the
  42. current column (usually the first in this mode).
  43. - blockwise: Only the selected text. This is
  44. implemented by temporarily duplicating the selection
  45. to separate lines and repeating over those, starting
  46. from the first column.
  47. Note: If the last normal mode command included a
  48. {motion} (e.g. g~e), the repetition will also move
  49. exactly over this {motion}, NOT the visual selection!
  50. It is thus best to repeat commands that work on the
  51. entire line (e.g. g~$).