I'm a vim user and I want to delete a keyword. I always use "dw" to delete specific keyword, but it sometimes doesn't work well. For example, I want to delete "valule123" in sample program.
ex) public void function(int valule123)
When I put my cursor is on "2", and then I input "dw", only part of keyword is deleted and the result is "val1". Why?
I tried another command, "daw". In this case, the result is just as expected! But what does "a" mean? I think "a" means "add".
Go into insert mode (hit i) and use the Delete key to remove the phrase. Hit escape when you have deleted all of the phrase.
Deleting a single line in Vim editor: First, bring your cursor to the line you want to delete. Press the “Esc” key to change the mode. Now type, “:d”, and press “Enter” to delete the line or quickly press “dd”.
How do I match and remove (delete) the words “ssh_args=-p 1222” from config file using sed command under Linux or Unix like operating systems? You can use the the substitute sed command changes all occurrences of the “ssh_args=-p 1222”. The same command can be used to delete the required words.
The command/action/verb d
in Vim acts on an object. For dw
the object is "all text the cursor moves over with a w
command". For daw
you're actually using a Vim concept called a "text object". There are many of these, including aw
(a word), as
(a sentence), i}
(inner {...} block, e.g. code within a block in C code), it
(inner tag, useful for XML-like languages), and more.
See :help text-objects
for the full list.
These can not only be used by the d
command, but any command/action/verb that takes an object. For example, =aB
will reindent an entire code block, cas
will delete a sentence and drop you into insert mode to type a new one, and yit
will yank/copy everything inside the current XML tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With