Consider this code:
foo = (int)someVariable - 42;
bar = someFunction('someArgument') + 42;
By placing the cursor on the leading character of someVariable
and someFunction
we can experiment with dw
, daw
, and diw
. We can see that the commands have the following behaviour regarding the deletion of whitespace from the Left and Right sides:
L? R?
----------
daw Y Y
dw . Y
diw . .
L?: Deletes whitespace from the left
R?: Deletes whitespace from the right
The daw
command will delete whitespace from either side of the text, whereas dw
will only delete from the right and diw
will not delete whitespace from either side. Is there a command that will delete whitespace only from the left, but not from the right?
Note that this is not an issue that I am having with VIM, but rather my experimentation to learn the editor better.
daw
with the cursor anywhere onsomeFunction
will also delete the space between it and=
. If you remove this space, your code still means something while you'd get gibberish if you'd removed the space betweenlorem ipsum
.