File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 11" Vim indent file
22" Language: Python
33" Author: Akinori Hattori <[email protected] >4- " Last Change: 2023-07-21
4+ " Last Change: 2025-11-22
55" License: MIT License
66
77if exists (' b:did_indent' )
@@ -31,7 +31,7 @@ let s:compound_stmts = {
3131\ ' \v^\s*<else>' : ' \v^\s*<%(if|elif|while|%(async\s+)=for|try|except)>' ,
3232\ ' \v^\s*<except>' : ' \v^\s*<%(try|except)>' ,
3333\ ' \v^\s*<finally>' : ' \v^\s*<%(try|except|else)>' ,
34- \ ' \v^\s*<case>' : ' \v^\s*<case>' ,
34+ \ ' \v^\s*<case>' : ' \v^\s*<%(match| case) >' ,
3535\}
3636let s: dedent = ' \v^\s*<%(pass|return|raise|break|continue)>'
3737let s: ellipsis = ' \v^\s*\.{3}\.@!'
@@ -94,7 +94,12 @@ function! GetPEP8PythonIndent() abort
9494 endwhile
9595 let pind = indent (lnum)
9696 if pind < ind
97- if getline (lnum) = ~# pat
97+ let l = getline (lnum)
98+ if l = ~# pat
99+ let kw = s: matchkw (l )
100+ if kw == # ' match'
101+ return pind + shiftwidth ()
102+ endif
98103 return pind
99104 endif
100105 let ind = pind
Original file line number Diff line number Diff line change @@ -1031,6 +1031,20 @@ Describe filetype indent
10311031 \]
10321032 Assert Equals(Insert(in), Buffer(out))
10331033 End
1034+
1035+ It indents nested match statements
1036+ let in = "match spam:\<CR>"
1037+ let in .= "case eggs:\<CR>"
1038+ let in .= "match ham:\<CR>"
1039+ let in .= "case toast:"
1040+ let out = [
1041+ \ 'match spam:',
1042+ \ ' case eggs:',
1043+ \ ' match ham:',
1044+ \ ' case toast:',
1045+ \]
1046+ Assert Equals(Insert(in), Buffer(out))
1047+ End
10341048 End
10351049
10361050 Describe function definition
You can’t perform that action at this time.
0 commit comments