12

I usually want to cut the word under cursor and paste it somewhere else, is there any existing command can do this?

For example, if the cursor is under x in AA BXB CC DD, the result should be AA CC DD while BXB is copied to system clipboard.

2
  • yup. added an ELI5 example to add "clarity".
    – Yar
    Apr 22, 2022 at 7:23
  • to answer the question, in case you mapped d to not copy text when deleting, you can use viwx to highlight and cut the word under the cursor.
    – Yar
    Apr 22, 2022 at 7:24

1 Answer 1

17

Type diw

This means delete in word.

Related commands:

  • To copy: yiw
  • To cut: ciw
3
  • 8
    ciw actually cuts the word and then puts you into insert mode. yiw would copy the word.
    – George
    Mar 17, 2013 at 2:07
  • diW for deleting word where a word separator is considered to be only a space. So this will delete "words" with non alpha-numeric chars such as '/' etc Nov 22, 2018 at 9:13
  • 1
    ciw stands for "change in word", not for "cut". In fact, it puts you in insert mode, so you can "change" what was written before. The command diw is the right answer.
    – Tropilio
    Mar 30, 2020 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.