0

The shortcut >> doesn't indent lines that start with # for me in either C or Python when smartindent is set.

If anyone has a workaround, that would be cool; I'm also posting this let people know (it was rather confusing and frustrating why that key wasn't working).

dlmeetei
  • 9,905
  • 3
  • 31
  • 38
gatoatigrado
  • 16,580
  • 18
  • 81
  • 143
  • 1
    Possible duplicate of [How to configure vim to not put comments at the beginning of lines while editing python files](https://stackoverflow.com/questions/354097/how-to-configure-vim-to-not-put-comments-at-the-beginning-of-lines-while-editing) – dlmeetei Sep 21 '17 at 13:34

2 Answers2

2

This is discussed in a related post on SO, which refers to :h smartindent and recommends setting nosmartindent as a workaround. Are you using filetype indent on to get the full language-dependent indenting?:

Vim automatically removes indentation on Python comments

Community
  • 1
  • 1
Herbert Sitz
  • 21,858
  • 9
  • 50
  • 54
0

Yes, the behavior is expected >> does not work with # as documented in :help smartindent. The doc also has a work around given:

:inoremap # X^H#

where ^H is entered as Ctrl + V Ctrl + H

dlmeetei
  • 9,905
  • 3
  • 31
  • 38