Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1043549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:41:04+00:00 2026-05-16T15:41:04+00:00

when I open Python files my indentation changes. I have the following vimrc settings:

  • 0

when I open Python files my indentation changes. I have the following vimrc settings:

set number
colorscheme wombat256mod
set guifont=Consolas\ 11
set linespace=2
filetype on
filetype plugin on

au BufRead,BufNewFile *py,*pyw,*.c,*.h set tabstop=4
au BufRead,BufNewFile *.py,*pyw set shiftwidth=4
au BufRead,BufNewFile *.py,*.pyw set expandtab
fu Select_c_style()
    if search('^\t', 'n', 150)
    set shiftwidth=8
    set noexpandtab
    el 
    set shiftwidth=4
    set expandtab
    en
endf
au BufRead,BufNewFile *.c,*.h call Select_c_style()
au BufRead,BufNewFile Makefile* set noexpandtab
highlight BadWhitespace ctermbg=red guibg=red
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set textwidth=79
au BufRead,BufNewFile *.c,*.h set formatoptions-=c formatoptions-=o formatoptions-=r
au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
let python_highlight_all=1
syntax on
filetype indent on
set autoindent

Anybody see something that can cause it?

For example I open an *.html file the indentation is a tab. But once I opened any Python file and go back to the html file the indentation switches to python preferences.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:41:05+00:00Added an answer on May 16, 2026 at 3:41 pm

    The au lines with *.py in them are what are changing your settings. Notably,

    au BufRead,BufNewFile *.py,*pyw set shiftwidth=4
    au BufRead,BufNewFile *.py,*.pyw set expandtab
    

    You need to “undo” these settings when opening HTML files. Just add a few more autocmds that work on *.html to set noexpandtab and set your shiftwidth back to 8.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file I'm trying to open up in python with the following
I have multiple python files for a school project that I want to open
I have the following Python code to write dependency files of a project. It
Suppose I have some Python code like the following: input = open(input.txt) x =
I have the following python code. import sys ins = open( sys.argv[1], "r" )
The following code: with open(J:\\python\\.data) as data: self.data=pickle.load(data) generated the following error: File J:\python\code.py,
I am trying to open a text file in python. In the following code:
Possible Duplicate: check what files are open in Python Hello, Is it possible to
I'm creating sparse files in python as follows: >>> f = open('testfile', 'ab') >>>
I'm trying to copy files inside a Python script using the following code: inf,outf

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.