When I click the file again with gg=G
, I notice that the indentation of the closing parenthesis or parenthesis does not match the opening line. For example (with leading tabs shown with> ...)
if settings.DEBUG: >...urlpatterns += patterns('', >...>...url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { >...>...>...'document_root': settings.MEDIA_ROOT, >...>...}), >...)
I wanted to fix the indentation in the file that contains this. For python, my softtabstop
set to 4, shiftwidth
set to 4 and expandtab
. When I did gg=G
, this led to the following:
if settings.DEBUG: urlpatterns += patterns('', url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, }), )
There are two problems there. Firstly, the closing brackets do not coincide with the space level of their opening brackets, they recede at the same level as the code inside the brackets. This can be seen both with (
in the second line, and with its correspondence )
in the last line, as well as with {
in the third line and its coincidence }
in the fifth line. I would like the closing brackets to match at the same level as their opening brackets.
My second problem is that the indentation after opening the parenthesis doubles the indentation for the new block or even after opening {
. I think this may be part of the file type fingerprint for Python, but I wonder how I can stop this, so all indentation is 4 inches wide.
source share