python.vim 823 B

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