How to skip a command in repetition

How can I skip the wile command with redo (ctrl-R)? I made a mistake and put my file in lowercase, I can go back and cancel the command, how can I repeat all other commands after?

+3


source to share


2 answers


I think there is no easy way to do this. I am guessing that the changes were quite complex and that you may have spent some time reviewing them, otherwise you might have just typed them in again. You can try the following options:

  • start recording the macro ( :help q

    ), enter your changes, stop recording, then change all text to lowercase ( gggUG

    ). You can then compare it to the previous version ( windo difft

    ) - it will remind you of any changes you have lost and you save the time to check every detail of the changes.
  • use :DiffOrig

    which is the default vimrc ( $VIMRUNTIME/vimrc_example.vim

    ) and explained in the help files to compare your final text with the version before changing to lower case, you can figure out if it is easier to repeat the changes or fix the case of the text.



Edit:

:DiffOrig

will help you do what you explained in the comments.

Also note that it is probably editable and they apply undo history, but this can be more difficult to achieve than manually redoing the changes. If it's something common in your workflow, it might be worth it - in which case you could base and include it in some existing theme plugin like undotree .

+3


source


Vim undo-redo is very powerful, supporting not only one linear sequence but also a full tree (cp. :help undo-branches

). Unfortunately, whatever you ask is not possible, since Vim keeps every command (and its effects) relative to the others; skipping any can damage the entire cancellation history.



To achieve something like this, you need to pre-record the steps in a macro (as suggested by @mMontu); macros within a register can be undone, edited and re-executed.

0


source







All Articles