5

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'?

Chris Doyle
  • 1,029
  • 12
  • 15

2 Answers2

9

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

ciW
Birei
  • 35,723
  • 2
  • 77
  • 82
  • awesome! That's gonna make my life much easier. I do have another slightly more complicated scenario I'm wondering about: same as above but the code is `if (abc.xyz == "123")` and I don't want to select the open-paren – Chris Doyle Oct 24 '13 at 16:14
  • @ChrisDoyle: For that new scenario look at [perreal's](http://stackoverflow.com/users/390913/perreal) answer. – Birei Oct 24 '13 at 16:21
6

Include the . in the iskeyword option:

set iskeyword=@,48-57,_,192-255,.
perreal
  • 94,503
  • 21
  • 155
  • 181
  • 3
    Better just add to the default: `:set iskeyword+=.`; and I wouldn't set this globally, but (with `:setlocal`) only for certain filetypes (in `~/.vim/after/ftplugin/.vim`). – Ingo Karkat Oct 24 '13 at 18:58