Chris Doyle
Chris Doyle

Reputation: 1039

How can I include periods when selecting a word in vim?

Let's say I'm calling a method on an object in my code like

if abc.xyz then foo

My cursor is on the 'c' in 'abc' and I want to change abc.xyz to something else. If I type ciw I'll be replacing only 'abc'. What can I use instead of iw so that it selects the entire 'abc.xyz'?

Upvotes: 5

Views: 755

Answers (2)

perreal
perreal

Reputation: 97958

Include the . in the iskeyword option:

set iskeyword=@,48-57,_,192-255,.

Upvotes: 6

Birei
Birei

Reputation: 36262

Use W to separate words only with whitespace characters, it will select the whole string:

ciW

Upvotes: 9

Related Questions