RepeatLast.vim : Provides [count]\. to repeat the last group of actions you performed.
| script karma
Downloaded by 237
Comments, bugs, improvements
script versions (upload new version)
|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'
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
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.)
|Drop it in plugin/ folder.
Latest version at https://github.com/joeytwiddle/RepeatLast.vim
Click on the package to download.
ip used for rating: 188.8.131.52
||After \? (:ShowRecent) the <Enter> or <Space> used on the |hit-enter-prompt| should now be ignored.
||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.
||Removed debugging code which I had accidentally left in
||reduced triggering of CursorHold based on user interaction speed, and other modes
||Minor updates to documentation.
||Can now trigger CursorHold events, without which some visual plugins may not act normally.