8

Following my pressing ':' I can switch to command insert mode and pressing 'Up Arrow' I can bring up my previous command.

How can I delete a word left of my cursor during command insert mode? Say for my example I have this in my command pane:

:!sh listtablefromdb.sh mytablename

I would like to delete mytablename via single keyboard shortcut

2 Answers 2

17

If you press Ctrl-U all characters to the left of the cursor until the beginning of the commandline will be deleted. This is also explained in the help at :h c_CTRL-U

To delete a single word, you can use Ctrl-W(:h c_CTRL-W)

3
  • 3
    Use Ctrl-W to delete a single word Jan 3, 2018 at 10:20
  • 2
    Use q: or <c-f> to open the command-line window to unleash even more power! See :h cmdwin Jan 3, 2018 at 15:09
  • how do I delete a word/line to the right in insert mode? Oct 27, 2020 at 3:00
6

Ctrl-W will delete one word.

Your Answer

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

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