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).
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
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
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论