Commit Graph

24 Commits

Author SHA1 Message Date
Christian Wellenbrock
7568a9604b Revert order of feedkeys calls to fix counts
Since we are using the `i` flag, the feedkeys calls insert the keys
instead of appending. That's why we need to insert the second part of
the command before inserting the first part in front of it.
2015-04-03 12:30:43 +02:00
Konfekt
88e7d7e5c3 remove trailing spaces in remaps
Vim interprets `nmap <key> <mapping> ` as `nmap <key> <mapping><space>`. 
Here we do not want this and put `|` directly after `<mapping>`.
2015-02-20 21:28:28 +01:00
Konfekt
cffb2e7578 more convenient remapping by using <plug> mappings
Now mappings can be remapped in `.vimrc` by
`nnoremap <key> <Plug>(RepeatUndoLine)`
and disablabled in `.vimrc` by
`nnoremap <SID>(DisableRepeatUndoLine) <Plug>(RepeatUndoLine)`
2015-02-20 21:14:38 +01:00
Christian Wellenbrock
ad89be240f Pass flag 'i' to feedkeys() calls
Only fall back to :norm for versions 7.3.100 <= v < 7.4.601
2015-01-28 16:51:28 +01:00
Justin M. Keyes
006694e0f5 Fix condition for Vim <= 7.3 2015-01-19 17:09:05 -05:00
Tim Pope
7f09c18d2e Merge pull request #36 from justinmk/norm
Use :norm for Vim 7.3.100 or later
2015-01-19 14:42:53 -06:00
Justin M. Keyes
193f4866df Use :norm for Vim 7.3.100 or later
Fixes #23
2015-01-17 09:55:08 -05:00
Jacob Niehus
80261bc531 Fix invalidate() being overridden by autocmd 2015-01-10 18:47:31 -07:00
d125q
5eba0f19c8 Make repeat#wrap open a fold if &foldopen contains 'all'
Closes #31.
2014-12-08 19:48:38 -05:00
Tim Pope
2a3c5f8e3c Allow repeating operators with custom motions
Closes #8.
2013-12-24 10:44:09 -05:00
Tim Pope
a81bef7603 repeat.vim 1.1
* Fix adding trailing spaces when 've' is not empty.
* Don't increment b:changedtick, offer invalidate instead.
* Support repetition with original register.
* Don't clobber existing U map.
* Respect 'foldopen' on undo.
* Allow customizing all mappings.
2013-01-01 00:17:12 -05:00
Ingo Karkat
8ee7450812 Allow customizing all mappings
f1d0fbbdf4 allowed customizing the .
mapping by making the implementation function publicly accessible. Let's
do the same to s:wrap(), so that the other mappings (u, U, <C-R>) can be
extended, too.

(Personally, I'd like to have undo / redo stop and beep at the last
saved position, to avoid that I accidentally undo beyond the saved state
even though I didn't intend to.)
2012-12-31 16:06:45 -05:00
Ingo Karkat
aeb3d6cd89 Documentation fix for repeat#setreg()
Need to :execute the :silent! call to avoid that the remainder of the
command line is aborted together with the call when repeat.vim is not
installed. Otherwise, <SID>MyFunction() won't be invoked, and the
mapping does nothing.
2012-12-01 16:05:05 -05:00
Andrew Radev
d8f7fe7598 Go back to using feedkeys()
Since there seems to be a bug with "norm" in Vim prior to 7.3.100,
better go back to using feedkeys.

The repeat call can still be remapped by using something like:

  nnoremap . :call repeat#run(v:count)<bar>call feedkeys('`.', 'n')<cr>
2012-11-24 00:23:14 -05:00
Andrew Radev
f1d0fbbdf4 Allow for some additional post-processing
This commit makes the s:repeat function public as repeat#run to allow
manual remapping for customization.
2012-11-03 16:21:28 -04:00
Tim Pope
613eb1c812 Respect 'foldopen' on undo
Closes #9.
2012-08-22 11:30:12 -04:00
Tim Pope
d75a544b78 Don't clobber existing U map
Closes #6.
2012-05-02 19:13:33 -04:00
Ingo Karkat
2914f11f74 Support repetition with original register
For commands that take an optional register (like p/P), Vim uses the
same register on repetition. This enhancement allows the same for custom
mappings, which need to call repeat#setreg() before repeat#set(). (No
changes for the vast majority of mappings that don't use registers.) It
even supports repeat of the expression register, with the expression
being re-evaluated on repeat.
2012-03-10 14:18:41 -05:00
Ingo Karkat
476c28084e Don't increment b:changedtick, offer invalidate instead
repeat#set() so far automatically incremented b:changedtick. Problems
with this:
1. The way that was done clobbered the expression register "=.
2. It causes the "readonly" warning and "Cannot make changes" error in
   readonly/nomodifiable buffers, so mappings that don't modify anything
   cannot be repeated there.
3. It's actually not needed most of the time, because many user mappings
   and all repeatable Vim built-in normal mode commands I know (with the
   exception of yank with cpo+=y) actually do modify the buffer
   themselves.

For the exceptional case where the user has a set of related mappings,
one that repeats naturally (e.g. a custom operator, via g@), and one
that invokes repeat#set(), and both do not modify the buffer, a new
function repeat#invalidate() is offered. This should be called by the
former mapping, and all is well.
2012-03-10 14:16:58 -05:00
xaizek
1118a8324f Fix adding trailing spaces when 've' is not empty
The problem appears when cursor is positioned after line end, thus
running p command (even with empty "-register) causes Vim to add spaces
from line end until cursor.
2012-02-23 16:41:35 -05:00
Tim Pope
cdffdd4381 Clarify copyright 2011-08-29 16:11:07 -04:00
Tim Pope
ecab7ca1b7 Fix heading 2011-08-29 02:47:25 -04:00
Tim Pope
1f19cf2a03 Add script id to heading 2011-08-29 02:14:44 -04:00
Tim Pope
c4101c205e Initial commit 2008-04-25 17:24:17 -05:00