How to add a new line with the same indentation
-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping
--
Chapters
00:00 Question
00:23 Accepted answer (Score 43)
00:38 Answer 2 (Score 9)
00:55 Answer 3 (Score 5)
01:12 Answer 4 (Score 0)
01:36 Thank you
--
Full question
https://superuser.com/questions/99741/ho...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#vim
#avk47
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping
--
Chapters
00:00 Question
00:23 Accepted answer (Score 43)
00:38 Answer 2 (Score 9)
00:55 Answer 3 (Score 5)
01:12 Answer 4 (Score 0)
01:36 Thank you
--
Full question
https://superuser.com/questions/99741/ho...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#vim
#avk47
ACCEPTED ANSWER
Score 45
Adding set autoindent
to your ~/.vimrc can do that for you automagically.
ANSWER 2
Score 9
I'd also suggest adding this to your .vimrc:
set smartindent
It will increase the indent in a new block.
ANSWER 3
Score 5
Both will annoy you when pasting, as Vim will try and indent everything on the fly.
Prior to pasting enter:
:set paste
ANSWER 4
Score 0
At bottom of the file, I'm using:
# vim: ts=2 sw=2 sts=2 sr noet st ai si
For example Dockerfile
:
FROM centos-7
RUN ...
CMD ...
# vim: ts=2 sw=2 sts=2 sr noet st ai si
If you want keep the indentation only, use # vim: st ai si