Code Monkey home page Code Monkey logo

redocommand's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1661

DESCRIPTION
Re-executes the last / Nth ex command previously entered in command mode. An
optional pattern is used to locate the most recent matching command. This is
similar to the command-line window (q:), or navigating the command history via
<Up> and <Down>, but provides an even faster way to re-execute a command if
you remember some characters or a pattern that identifies the command line.
The redocommand itself will not be included in the command history. Global
literal replacement can be done via 'old=new' arguments.

This is modeled after the 'fc -s' command from the Posix shell (which is often
aliased to 'r').

USAGE
:[N]Redocommand (or abbreviated :R)
                        Execute the last / Nth ex command.

:[N]Redocommand {pattern}
                        Execute the last / Nth ex command that matches
                        {pattern}.
                        Settings such as 'magic' and 'ignorecase' apply.

                        With N=0, only the very last command from the history
                        is executed if it matches {pattern}; the entire
                        history isn't searched.

                        Note: If the {pattern} starts with : (and there is no
                        history command matching the literal ":cmd"), the
                        history is searched for "cmd", anchored at the
                        beginning. This is convenient because ":R :echo" is
                        more intuitive to type than ":R ^echo".

:[N]Redocommand {old}={new} [{old2}={new2} ...] [{pattern}]
                        Execute the last / Nth ex command (that matches
                        {pattern}), replacing all literal occurrences of {old}
                        with {new}.

:[N]RedoRepeat [{old}={new} ...] (or abbreviated :RR)
                        Execute the last / Nth ex command that was repeated
                        via :Redocommand. Any replacements done the last time
                        are still in effect; new replacements of {old} to
                        {new} can be added.

The following variants are useful when you repeatedly use command A in one
buffer and command B in another. Instead of passing different [N] values to
:RedoRepeat, just recall from the local redo history.

:[N]RedoBufferRepeat [{old}={new} ...] (or abbreviated :RB)
                        Like :RedoRepeat, but repeat the last / Nth ex
                        command repeated in the current buffer.

:[N]RedoWindowRepeat [{old}={new} ...] (or abbreviated :RW)
                        Like :RedoRepeat, but repeat the last / Nth ex
                        command repeated in the current window.

EXAMPLE
Given the following history:
    :history
    1 e foo.txt
    2 %s/foo/\0bar/g
    3 w bar.txt
:Redocommand            will execute :w bar.txt
:Redocommand %          will execute :%s/foo\0/bar/g
:Redocommand foo        will execute :%s/foo\0/bar/g
:2Redocommand foo       will execute :e foo.txt
:Redocommand b=B .txt=  will execute ':w bar.txt' as :w Bar

:echo "another command"
:RedoRepeat             will again execute :w Bar
:2RedoRepeat            will execute :%s/foo\0/bar/g
:RedoRepeat B=F         will execute :w Far
:Redocommand            will execute :echo "another command"
:RedoRepeat             will execute :w Far

redocommand's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.