The question is simple and clear. I have recently been learning how to use GVIM and encountered some problems with automatic indentation. Generally speaking, GVIM will automatically indent most of my code for me, but when I start a new line and then enter # and the following comments, the line will always start from the beginning automatically. Instead of automatically indenting and aligning like other lines of code. Have you ever encountered similar problems? How to solve it? Thanks.
P.S. My vimrc part is as follows:
set softtabstop=4
set shiftwidth=4
set tabstop=4
set expandtab
For Python, a simple and crude method is:
You can add the above commands to autocommand or ftplugin