Can anyone explain to me why when writing python code, vim is auto indenting when entering carriage return after function call ie. f.write(name, r)
Before writing(:w) file
import bs4 as bs
import urllib.request
sauce = urllib.request.urlopen('http://www.google.com').read()
soup = bs.BeautifulSoup(sauce, 'lxml')
path = "~/Workspace/scraping/"
filename = "demo.html"
fullname = path + filename
f=open(fullname, 'w')
f.write(soup)
print(f) #why auto indenting here?
After writing (:w) file
import bs4 as bs
import urllib.request
sauce = urllib.request.urlopen('http://www.google.com').read()
soup = bs.BeautifulSoup(sauce, 'lxml')
path = "~/Workspace/scraping/"
filename = "demo.html"
fullname = path + filename
f=open(fullname, 'w') #???
f.write(soup) #???
print(f) #???
.vimrc file setting for python file
autocmd BufNewFile, BufRead *.py
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=80
autocmd BufWritePre *.py :normal gg=G
"indent settings for all files
set cindent
set autoindent
Machine Details
VIM
Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Features:
-python
+python3
Python
Python 2.7.12
Python 3.5.2
Any input at all would be greatly appreciated. Cheers!