This is my current .vimrc:
cat ~/.vimrc
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
set nu
set autoindent
set cindent
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
I am debugging others' code and when I inserted a new line, it seems automatically indented with the next line. However, when I execute the python program, it complaints. For example, I added a print statement to the following:
for i, third in enumerate(third_list):
j = i % 4
third_group4[j] = third
print('i, j', i, j)
if j == 3:
....
The print seems aligns well with other lines, but it complains:
python test.py
File "test.py", line 156
if j == 3:
^
IndentationError: unexpected indent
The next line got the complaints about the indent. I manually checked and found that instead of the original 8 leading spaces in front of 'if', the first 4 spaces are a tab, which is also 4 spaces long. The 1-tab+4 spaces are the same length as the 8 spaces, but that's why it complains.
I tested a few other print statements and it seems it always affected the following line when I inserted a print statemnt.
How can I void this? I don't want to manually fixe the indent whenever I made a little change to the code. I am on Centos 7.