Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: Insert or Append with indendation

Tags:

vim

When I am adding a line via O or o it is added according to the indentation around it.

Is there a way to do the same when using A or I?

class
  def method
▋                  | cursor starts in the first column
  end
end

... *clickety-click* ...

class
  def method
    ▋              | cursor is correctly positioned inside the method
  end
end

O and o do that out of the box but then I have to start at the line higher/lower.

like image 954
firedev Avatar asked Jul 15 '26 07:07

firedev


1 Answers

Use S or cc to start insert mode at the right indentation level.

like image 153
romainl Avatar answered Jul 17 '26 20:07

romainl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!