keepcase.vim : Functions for doing case-persistant substitutions
script karma |
Rating 181/62,
Downloaded by 3881 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Michael Geddes |
|
script type |
utility |
|
description |
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
|
|
install details |
Place in plugin directory |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 142.132.191.50
|