Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k 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 OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...