Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: command to clear current line and drop into insert mode

I am in normal mode, at the end of a line. I want to clear the line (delete all characters of the line), and drop into insert mode so that I can start writing something else on that line. Is there a Vim shortcut for this?

Ideally, I would like to preserve the leading whitespaces on the line, but even if I can't that should be fine.

like image 964
Rushi Agrawal Avatar asked Sep 27 '18 06:09

Rushi Agrawal


1 Answers

You can use S or cc to do that (synonyms). They will keep your indentation if the autoindent option is on. Both can accept an optional count if you want to remove multiple lines.

like image 156
sidyll Avatar answered Nov 15 '22 08:11

sidyll