On Tuesday, April 3, 2012 7:52:17 PM UTC-7, Zvezdan Petkovic wrote: > On Apr 3, 2012, at 10:08 PM, Zvezdan Petkovic wrote: > > > Now, I'll dig into this and find which setting fixes the issues you see by > > gradually returning things in place. I'll narrow this down this evening > > probably. > > > I found what's causing this behavior. > My customizations for Python are not doing anything special. > The docstring is indented correctly even when ~/.vim is empty. > > However, when I comment out one line in my .vimrc file the indentation > changes. > > It seems that you are missing this kind of setting in your ~/.vimrc file (I > put it at the very end of that file): > > if has("autocmd") > " Enable file type detection, plugins, and indentation rules. > filetype plugin indent on > " ^^^^^^ DOES NOT WORK WITHOUT THAT LINE ^^^^^^ > " ... > " vvvvvv You mentioned you have something like this already vvvvvv > " C++, Java, JavaScript, Perl, Python and Tcl indent. > autocmd FileType cpp,java,javascript,perl,python,tcl setl sw=4 sts=4 > et > " ... > " vvvvvv I keep also this for doctests vvvvvv > " reStructuredText (Python doctest) indent. > autocmd FileType rst setlocal sw=4 sts=4 et tw=72 > " When editing a file, always jump to the last known cursor position. > autocmd BufReadPost * > \ if line("'\"") > 0 && line("'\"") <= line("$") | > \ execute "normal g`\"" | > \ endif > endif > > ***** > You must have "filetype plugin indent on" to get the indent to work properly. > It's best to wrap it in 'if has("autocmd") ... endif' sequence. > ***** > > That should solve your docstring indentation. > > Couple of things that I keep in my ~/.vim/ftplugin/python.vim, but they can > be defined in ~/.vimrc as well (if one is not sure how to write a plugin > startup and cleanup parts): > > These are useful to keep the indentation that conforms to PEP-8 style. > > " Indent any continuation line 'shiftwidth' spaces > let g:pyindent_open_paren = '&sw' > let g:pyindent_nested_paren = '&sw' > let g:pyindent_continue = '&sw' > > You can also add more highlight if you want: > > " Highlight more > let python_highlight_all = 1 > > OK. I think this should help you. > Please, tell us if this solves your indentation problems. > > Regards, > > Zvezdan
Did not work. I already have filetype indent on. When I first noticed this problem, that's what I checked with the command filetype: filetype detection:ON plugin:ON indent:ON I believe this is being turn on by /etc/vimrc. I will try to move rc files around to see if there is any effect. -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php