Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
960 views
in Technique[技术] by (71.8m points)

vim - Change text inside any character (like ci')

Is it possible to change inside any character?

For example I can change inside ' by using ci'.

I want to change inside the - character, like this:

--I want to change inside this --

I am unable to do this with ci-.

question from:https://stackoverflow.com/questions/65888146/change-text-inside-any-character-like-ci

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is not possible by default but you can create your own text-objects. Check this plugin: targets.vim Also have a look at :help operator and :help mapmode-o

Long story short, this seems to do the trick: :omap i- :<C-u>normal!T-vt-<CR>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...