RepeatLast.vim : Provides [count]\. to repeat the last group of actions you performed.
script karma |
Rating 28/9,
Downloaded by 4391 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
joey twiddle |
|
script type |
utility |
|
description |
RepeatLast.vim by joeytwiddle
Provides <count>\. to repeat the last group of actions you performed.
"A beautiful monster" -- bairui in #vim
The '.' key is fantastic for repeating the last 1 action you made. But
sometimes I do three actions, and then want to repeat them again. Now
this is just 3\.
BEWARE: Because it uses macro recording *all the time*, it sort of takes
over your Vim, and can impact your usual experience. Be prepared!
:set ch=2 if the word "recording" hides messages you wanted
:let g:RepeatLast_TriggerCursorHold = 1 or 0 for GUI fixes
Also: :RepeatLastDisable :RepeatLastEnable :RepeatLastToggleDebugging
== Usage ==
Assuming your mapleader is '' (the default), these |mappings| are created:
\? Display a list of recently recorded actions
4\? Display the last four recorded actions
\. Repeat the last action (similar to . but may replay just a movement)
4\. Repeat the last four recorded actions (including movement actions)
\\. Replay the last *repeated* action-group (all 4 actions above)
9\\. Replay the last *repeated* action-group 9 times (producing 9 times 4)
\D Forget (drop) the last action (e.g. to discard an unwanted movement)
3\D Drop the last 3 recorded actions (useful to get back to earlier state)
\| or \#
Temporarily enable/disable recording for the next few actions
(Allows free movement without adding new actions to history)
4\G Grab the last 4 actions and store in register 'g'
@g Repeat the actions stored in register 'g'
:let @i=@g
Copy the actions to register 'i', so 'g' may be overwritten.
:let g:RepeatLast_SaveToRegister = 'p'
Always save any repeated action-group into @p
:let g:RepeatLast_TriggerCursorHold = 0
Disable the UI fix. CursorHold events will not fire.
Commands are also available for the main shortcuts above:
:ShowRecent :RepeatLast :DropLast :PauseRecording :GrabLast
Commands to toggle state at runtime:
:RepeatLastEnable Enables action recording, enters macro record mode.
:RepeatLastDisable Disables action recording, leaves macro record mode.
:RepeatLast<Ctrl-D> or <Tab> More commands, some toggle info.
New feature - Auto Ignoring:
After executing a repeat action, action storage will be *temporarily
disabled* for the number of actions specified by:
let g:RepeatLast_Ignore_After_Use_For = 10
This allows you to move to a new location between executing repeats,
without recording those movement actions.
Once you have performed enough actions without executing a repeat, action
storage will be re-enabled, and the ignored actions will be added to the
history as one large entry. Although g:RepeatLast_Stop_Ignoring_On_Edit
prevents this recovery.
Reading this rest of this file:
You may like to try :FoldNicely
== Limitations ==
It uses macro recording ALL THE TIME. The word "recording" will forever be
displayed in your command-line, hiding any messages usually displayed there
by Vim's echo. To make those hidden messages visible, you will need to:
:set cmdheight=2 or more
Because recording is enabled, for commands like `q:` and `q/` you will need
to press an extra `q` beforehand, and they will not be recorded in history.
If you want to record your own macro, you can disable the plugin with
:RepeatLastDisable (or you could try just pressing 'q' for a one-time disable).
CursorHold events do not fire in macro-recording mode. Any visual tools,
taglist updates, etc. that require CursorHold *will not be triggered*.
Other events such as CursorMove, InsertLeave, BufWritePost work fine.
The new option RepeatLast_TriggerCursorHold can now be used to force trigger
of CursorHold events. It may not be ideal, but mostly works ok.
== Disadvantages ==
Movements j and k will not return to the original column after passing
through shorter lines. (This is only a problem when using
RepeatLast_TriggerCursorHold.)
Use of some <Tab>-completion plugins may produce unexpected behaviour when
replaying actions including a <Tab>-completion. (Although Vim's built-in
'.' does not suffer from this.)
|
|
install details |
Drop it in plugin/ folder.
Latest version at https://github.com/joeytwiddle/RepeatLast.vim |
|
script versions (upload new version)
Click on the package to download.
RepeatLast.vim |
1.34g |
2013-07-19 |
7.0 |
joey twiddle |
After \? (:ShowRecent) the <Enter> or <Space> used on the |hit-enter-prompt| should now be ignored. |
RepeatLast.vim |
1.34f |
2013-07-14 |
7.0 |
joey twiddle |
Various modes for TriggerCursorHold, fairly safe default. Added choice of clobbered Register, ReRepeat, GrabLast, and many more updates. Now executing via macro rather than feedkeys, so noautocmd will work again. |
RepeatLast.vim |
1.34e |
2013-06-01 |
7.0 |
joey twiddle |
Removed debugging code which I had accidentally left in |
RepeatLast.vim |
1.34d |
2013-05-31 |
7.0 |
joey twiddle |
reduced triggering of CursorHold based on user interaction speed, and other modes |
RepeatLast.vim |
1.34c |
2013-05-09 |
7.0 |
joey twiddle |
Minor updates to documentation. |
RepeatLast.vim |
1.34 |
2013-04-25 |
7.0 |
joey twiddle |
Can now trigger CursorHold events, without which some visual plugins may not act normally. |
RepeatLast.vim |
1 |
2013-01-02 |
6.0 |
joey twiddle |
Initial upload |
ip used for rating: 142.132.191.50
|