How to set automatic indentation of comment lines starting with # in GVIM
黄舟
黄舟 2017-05-16 16:36:25
0
1
565

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
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
某草草

For Python, a simple and crude method is:

set nocindent
set nosmartindent
set autoindent

You can add the above commands to autocommand or ftplugin

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template