2014-07-10 21:05:51 -07:00
|
|
|
" Vim indent file
|
2023-08-13 05:25:10 -07:00
|
|
|
" Language: Python
|
|
|
|
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
|
|
|
" Last Change: 2023 Aug 10
|
|
|
|
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
2014-07-10 21:05:51 -07:00
|
|
|
" Original Author: David Bustos <bustos@caltech.edu>
|
|
|
|
|
|
|
|
" Only load this indent file when no other was loaded.
|
|
|
|
if exists("b:did_indent")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let b:did_indent = 1
|
|
|
|
|
|
|
|
" Some preliminary settings
|
|
|
|
setlocal nolisp " Make sure lisp indenting doesn't supersede us
|
|
|
|
setlocal autoindent " indentexpr isn't much help otherwise
|
|
|
|
|
2022-07-26 02:26:23 -07:00
|
|
|
setlocal indentexpr=python#GetIndent(v:lnum)
|
2014-07-10 21:05:51 -07:00
|
|
|
setlocal indentkeys+=<:>,=elif,=except
|
|
|
|
|
2021-10-05 05:12:16 -07:00
|
|
|
let b:undo_indent = "setl ai< inde< indk< lisp<"
|
|
|
|
|
2014-07-10 21:05:51 -07:00
|
|
|
" Only define the function once.
|
|
|
|
if exists("*GetPythonIndent")
|
|
|
|
finish
|
|
|
|
endif
|
2021-04-27 22:33:17 -07:00
|
|
|
|
2022-07-26 02:26:23 -07:00
|
|
|
" Keep this for backward compatibility, new scripts should use
|
|
|
|
" python#GetIndent()
|
2014-07-10 21:05:51 -07:00
|
|
|
function GetPythonIndent(lnum)
|
2022-07-26 02:26:23 -07:00
|
|
|
return python#GetIndent(a:lnum)
|
2014-07-10 21:05:51 -07:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
" vim:sw=2
|