blob: 42ab4f3778c10b0246b5d876b8349f042e1046a8 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim indent file
Christian Brabandte978b452023-08-13 10:33:05 +02002" 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>
Bram Moolenaar071d4272004-06-13 20:20:40 +00006" Original Author: David Bustos <bustos@caltech.edu>
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
8" Only load this indent file when no other was loaded.
9if exists("b:did_indent")
10 finish
11endif
12let b:did_indent = 1
13
14" Some preliminary settings
15setlocal nolisp " Make sure lisp indenting doesn't supersede us
16setlocal autoindent " indentexpr isn't much help otherwise
17
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010018setlocal indentexpr=python#GetIndent(v:lnum)
Bram Moolenaar071d4272004-06-13 20:20:40 +000019setlocal indentkeys+=<:>,=elif,=except
20
Bram Moolenaar6e649222021-10-04 21:32:54 +010021let b:undo_indent = "setl ai< inde< indk< lisp<"
22
Bram Moolenaar071d4272004-06-13 20:20:40 +000023" Only define the function once.
24if exists("*GetPythonIndent")
25 finish
26endif
27
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010028" Keep this for backward compatibility, new scripts should use
29" python#GetIndent()
Bram Moolenaar071d4272004-06-13 20:20:40 +000030function GetPythonIndent(lnum)
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010031 return python#GetIndent(a:lnum)
Bram Moolenaar071d4272004-06-13 20:20:40 +000032endfunction
33
Bram Moolenaar071d4272004-06-13 20:20:40 +000034" vim:sw=2