python.vim (886B)
1 " Vim indent file 2 " Language: Python 3 " Maintainer: The Vim Project <https://github.com/vim/vim> 4 " Last Change: 2023 Aug 10 5 " Former Maintainer: Bram Moolenaar <Bram@vim.org> 6 " Original Author: David Bustos <bustos@caltech.edu> 7 8 " Only load this indent file when no other was loaded. 9 if exists("b:did_indent") 10 finish 11 endif 12 let b:did_indent = 1 13 14 " Some preliminary settings 15 setlocal nolisp " Make sure lisp indenting doesn't supersede us 16 setlocal autoindent " indentexpr isn't much help otherwise 17 18 setlocal indentexpr=python#GetIndent(v:lnum) 19 setlocal indentkeys+=<:>,=elif,=except 20 21 let b:undo_indent = "setl ai< inde< indk< lisp<" 22 23 " Only define the function once. 24 if exists("*GetPythonIndent") 25 finish 26 endif 27 28 " Keep this for backward compatibility, new scripts should use 29 " python#GetIndent() 30 function GetPythonIndent(lnum) 31 return python#GetIndent(a:lnum) 32 endfunction 33 34 " vim:sw=2