Ⅰ. 插件描述
Execute commands from the command history.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/redocommand'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/redocommand'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/redocommand'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/redocommand
Ⅳ. 文档说明
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/foo0/bar/g
:Redocommand foo will execute :%s/foo0/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/foo0/bar/g
:RedoRepeat B=F will execute :w Far
:Redocommand will execute :echo "another command"
:RedoRepeat will execute :w Far