blob: 8c3d0b0670dff454768736f924e18bd9d5182b4f [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim indent file
Bram Moolenaar4399ef42005-02-12 14:29:27 +00002" Language: Python
3" Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar071d4272004-06-13 20:20:40 +00004" Original Author: David Bustos <bustos@caltech.edu>
Bram Moolenaar6e649222021-10-04 21:32:54 +01005" Last Change: 2021 Sep 26
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7" Only load this indent file when no other was loaded.
8if exists("b:did_indent")
9 finish
10endif
11let b:did_indent = 1
12
13" Some preliminary settings
14setlocal nolisp " Make sure lisp indenting doesn't supersede us
15setlocal autoindent " indentexpr isn't much help otherwise
16
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010017setlocal indentexpr=python#GetIndent(v:lnum)
Bram Moolenaar071d4272004-06-13 20:20:40 +000018setlocal indentkeys+=<:>,=elif,=except
19
Bram Moolenaar6e649222021-10-04 21:32:54 +010020let b:undo_indent = "setl ai< inde< indk< lisp<"
21
Bram Moolenaar071d4272004-06-13 20:20:40 +000022" Only define the function once.
23if exists("*GetPythonIndent")
24 finish
25endif
26
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010027" Keep this for backward compatibility, new scripts should use
28" python#GetIndent()
Bram Moolenaar071d4272004-06-13 20:20:40 +000029function GetPythonIndent(lnum)
Bram Moolenaarb529cfb2022-07-25 15:42:07 +010030 return python#GetIndent(a:lnum)
Bram Moolenaar071d4272004-06-13 20:20:40 +000031endfunction
32
Bram Moolenaar071d4272004-06-13 20:20:40 +000033" vim:sw=2