Ⅰ. 插件描述
Functions for doing case-persistant substitutionsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/keepcase-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/keepcase-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/keepcase-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/keepcase.vim
Ⅳ. 文档说明
Usage: Using KeepCase or KeepCaseSameLen defined here, do a substitution like this:
%s/u<old_word>/=KeepCaseSameLen(submatch(0), 'new_word')/g
- KeepCase( original_word , new_word )
returns the new word maintaining case
simply uses heuristics to work out some different common situations
given NewWord
Word --> Newword
WORD --> NEWWORD
word --> newword
WoRd --> NewWord
woRd --> newWord
KeepCaseSameLen( original_word , new_word )
Returns the new word maintaining case Keeps the case exactly the same letter-for-letter It does work if the words aren't the same length, as it truncates or just coppies the case of the word for the length of the original word.- :SubstituteCase#ctoto(Titi)tata#1Tutu#g
totoTitiTata -> titiTutu
TotoTitiTata -> TitiTutu
tototititata -> tititutu
tototitiTata -> titiTutu
TototitiTata -> TitiTutu