Ⅰ. 插件描述
A vim plugin that replaces the currently selected text with the text in the delete registerⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'landonschropp/vim-stamp'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'landonschropp/vim-stamp'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'landonschropp/vim-stamp'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/landonschropp/vim-stamp
Ⅳ. 文档说明
# Vim Stamp
Stamp is a NeoVim and Vim plugin that makes it easy to
replace text with the contents of the last command. This allows you to very quickly replace text in
a repeatable way without the need for macros.
Demo
This is easiest to explain with a demo. Let's take this line of text as an example:
Hello Hola Bonjour Olà HalloWith your cursor on Hello, run yiw to copy the first word.
[H]ello Hola Bonjour Olà HalloNext, his w to move to Hola and run Siw (stamp inner word).
Hello [H]ello Bonjour Olà HalloTuh duh! You've just stamped a word. The contents of your unnamed register (in this case when you
yanked the first word) have now replaced the second word. You can use Stamp with any command that
populates the unnamed register, such as d, dd, y, yy and x.
If you have repeat.vim installed, you can repeat a stamp with
the . key. Try it by switching to the next word and then stamping again with w..
Hello Hello [H]ello Olà HalloThe great thing about Stamp is it works with any motion. That means you have maximum flexibility
when stamping. Some of the more useful motions include stamping inside strings (Si"), stamping
blocks (Sib), stamping paragraphs (Sip) and stamping until the end of the line (S$).
Stamp supports the following modes:
- Normal mode motions (
S<motion>) - Visual line selections (
V<motion>S) - Visual character selections (
v<motion>S) - Lines (
SS)
Installation
Stamp can be installed using your favorite Vim plugin manager. I recommend using
vim-plug.
Plug 'LandonSchropp/vim-stamp'If you'd like Stamp to work with the repeat key (.), you need to install the
repeat.vim plugin as well.
Development
If you'd like to poke around in this repo, it comes with a few scripts to make local development
much easier:
bin/run: Execute arbitrary commands inside of a Neovim instance that only has Vader
and Stamp loaded.bin/test: Run the Vader test suite.bin/example: Callsbin/runand loads a buffer with some sample data for easy,
on-the-fly testing.