Vim indentation with python getting wierd -
def main(): todo=todo()#this line shows 1 tab 1 sublime text print("the indentation not right")# 1 shows 2 tabs
i got wierd problem, cannot use vim edit python file anymore. indentation above same have, said indentation wrong. way, first line works right edit computer. use fedora 23 operating system , default tab vim 8 space on other files , need backspace delete, when create .py file, tab changes 4 spaces , need backspace 4 times cannot use vim edit files.
if wanna use tabs 8 spaces wide , 1 tab each indentation level, use
:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
or put in .vimrc
set tabstop=8 set softtabstop=8 set shiftwidth=8 set noexpandtab
for setting preferences python, put in vimrc
autocmd filetype python setlocal ts=8 sts=8 sw=8
or
autocmd filetype python set tabstop=8|set shiftwidth=2|set expandtab
for more information, please read secrets of tabs in vim , indenting source code (vim wiki)
you can read in old vim documentation
:help tabstop :help softtabstop
Comments
Post a Comment