11" Vim indent file
22" Language: Python
33" Author: Akinori Hattori <hattya@gmail.com>
4- " Last Change: 2019 -03-17
4+ " Last Change: 2020 -03-16
55" License: MIT License
66
77if exists (' b:did_indent' )
@@ -66,15 +66,15 @@ function! GetPEP8PythonIndent() abort
6666 let ind = indent (pos[0 ])
6767 if s: rbrkt () || getline (v: lnum ) !~# ' ^\s*[]})]'
6868 if s: is_compound_stmt (l , 1 )
69- let ind += s: ml_stmt () || ! s: is_compound_stmt (l ) ? s: sw () * 2 : s: sw ()
69+ let ind += s: ml_stmt () || ! s: is_compound_stmt (l ) ? shiftwidth () * 2 : shiftwidth ()
7070 else
7171 let ind += s: cont ()
7272 endif
7373 endif
7474 else
7575 let ind = strdisplaywidth (l [: pos[1 ] - 1 ])
7676 if s: ml_stmt () && s: is_compound_stmt (l )
77- let ind += s: sw ()
77+ let ind += shiftwidth ()
7878 endif
7979 endif
8080 return ind
@@ -130,14 +130,14 @@ function! GetPEP8PythonIndent() abort
130130 let ll = join (buf , ' ' )
131131 if ll = ~# ' :\s*\%(#.*\)\=$'
132132 " compound statement
133- let ind += s: sw ()
133+ let ind += shiftwidth ()
134134 elseif ll = ~# s: dedent
135135 " simple statement
136- let ind -= s: sw ()
136+ let ind -= shiftwidth ()
137137 elseif getline (v: lnum - 1 ) = ~# s: lcont
138138 " line continuation
139139 if s: is_compound_stmt (ll )
140- let ind += s: ml_stmt () ? s: sw () * 2 : s: sw ()
140+ let ind += s: ml_stmt () ? shiftwidth () * 2 : shiftwidth ()
141141 else
142142 let ind += s: cont ()
143143 endif
@@ -177,7 +177,7 @@ function! s:is_compound_stmt(str, ...) abort
177177endfunction
178178
179179function ! s: cont () abort
180- return eval (s: getvar (' python_indent_continue' , s: sw ()))
180+ return eval (s: getvar (' python_indent_continue' , shiftwidth ()))
181181endfunction
182182
183183function ! s: rbrkt () abort
@@ -192,13 +192,5 @@ function! s:getvar(name, ...) abort
192192 return get (b: , a: name , get (g: , a: name , a: 0 > 0 ? a: 1 : 0 ))
193193endfunction
194194
195- if exists (' *shiftwidth' )
196- let s: sw = function (' shiftwidth' )
197- else
198- function ! s: sw ()
199- return &sw
200- endfunction
201- endif
202-
203195let &cpo = s: save_cpo
204196unlet s: save_cpo
0 commit comments