python.vim 886 B

1234567891011121314151617181920212223242526272829303132333435
  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. " Only load this indent file when no other was loaded.
  8. if exists("b:did_indent")
  9. finish
  10. endif
  11. let b:did_indent = 1
  12. " Some preliminary settings
  13. setlocal nolisp " Make sure lisp indenting doesn't supersede us
  14. setlocal autoindent " indentexpr isn't much help otherwise
  15. setlocal indentexpr=python#GetIndent(v:lnum)
  16. setlocal indentkeys+=<:>,=elif,=except
  17. let b:undo_indent = "setl ai< inde< indk< lisp<"
  18. " Only define the function once.
  19. if exists("*GetPythonIndent")
  20. finish
  21. endif
  22. " Keep this for backward compatibility, new scripts should use
  23. " python#GetIndent()
  24. function GetPythonIndent(lnum)
  25. return python#GetIndent(a:lnum)
  26. endfunction
  27. " vim:sw=2