How to remove a word that has a dot in vim

Nowadays, if I have a word like this

bool t = someobject.someMethod() ;

      

If I want to delete

someobject.someMethod()

      

I do a diw

for some object and then diw

on someMethod and then use the delete button to clear the rest. I wanted to know what would be the fastest way to delete an entire word

 someobject.someMethod()

      

+3


source to share


2 answers


Typically, you use uppercase letters to include special characters, and remove until you reach a space:



Dw

+3


source


Are you sure you want to delete the word? I would guess that this piece of code you probably want to change it. You have several options:

  • Bct(

    change to symbol (

    . (Note: do not need to use B

    WORD to jump to the beginning).
  • BC

    to change to the end of the line. There really isn't much to save. ( B

    may not be needed)
  • c3iw

    change 3 inner words. (Warning requires counting for the first word as well)
  • ciW

    change the WORD. Note. This changes the parenthesis as well, but that's a small price to pay.

If you really want to do a delete, you can do a similar command, just replace c

with d

or c

with d

. Another option is to do diw

AND repeat the action twice using the command .

.



Personally, I prefer to search by invoice, so I prefer to use Bct(

to make changes. However, each option has its own usefulness depending on your needs.

For more help see:

:h word
:h WORD
:h c
:h C
:h t
:h B
:h iw
:h iW
:h .

      

+4


source







All Articles