0

I have set autoindent in my vimrc at the moment, and it's working how I wanted. However, if I skip over a line that it has auto-indented, the indents are removed after I hit enter or move with the arrow keys.

What I want:

(TAB)(TAB)//Some code here
(TAB)(TAB)
(TAB)(TAB)//Some more code here

What I get (if I begin from the first line):

(TAB)(TAB)//Some code here

(TAB)(TAB)//Some more code here

How do I keep the tabs from the line I kept blank for organization? I've tried using cindent and smartindent but I haven't gotten any good results.

5
  • Possible duplicate: vi.stackexchange.com/q/3612/18609
    – filbranden
    Commented Jul 26, 2021 at 19:55
  • 1
    @filbranden Ah, ok. I hadn't seen that when searching. Thank you! Commented Jul 26, 2021 at 20:06
  • Welcome to Vi and Vim! Did filbranden's link answer your question or no?
    – D. Ben Knoble
    Commented Jul 27, 2021 at 14:56
  • @D.BenKnoble Yes, perfectly! Should this post be removed as it is a duplicate, then? Commented Jul 27, 2021 at 17:15
  • No, I'll close it :) glad you got your answer !
    – D. Ben Knoble
    Commented Jul 27, 2021 at 20:54

0

Browse other questions tagged or ask your own question.