Ⅰ. 插件描述
Selective undo for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jaxbot/selective-undo-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jaxbot/selective-undo-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jaxbot/selective-undo-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jaxbot/selective-undo.vim
Ⅳ. 文档说明
# selective-undo.vim
Sparked by this discussion on r/vim, I put together a selective undo plugin for Vim.
This plugin is designed to operate undo on a visual selection, without touching the rest of the file.
Here's how it looks right now:

It was a pretty fun problem to solve.
It, however, is not complete. There are plenty of bugs, and a bit of limitations/quirkiness:
- Only operates on lines, not visual blocks
- It doesn't know when you run out of undo stacks, so repeatedly pressing undo can do weird things at the end of the stack.
- Probably a lot more
I'm open to pull requests and improving this, as I think this would be a really useful feature to have in my workflow.
That being said, this is based around a hack, so don't expect anything amazing from the code.
Enjoy!
MIT Licensed
Shameless plug
I hack around with Vim plugins a lot; if that sounds interesting to you, or you want to make my day, follow me :)