Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I cut a word under cursor in Vim? [closed]

Tags:

vim

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.

like image 797
zdd Avatar asked Mar 17 '13 02:03

zdd


People also ask

How do I delete a word before the cursor in Vim?

To delete one character before (to the left of) the cursor, type X (uppercase).

How do we cut to the end of the line Vim?

In normal mode, d is the key for cutting (deleting) text. Move the cursor to the desired position and press the d key, followed by the movement command. Here are some helpful deleting commands: dd - Delete (cut) the current line, including the newline character.


1 Answers

Type diw

This means delete in word.

Related commands:

  • To copy: yiw
  • To cut: ciw
like image 137
Ben Avatar answered Oct 24 '22 11:10

Ben