diff --git a/autoload/braceless.vim b/autoload/braceless.vim index 2c6c39e..45e8548 100644 --- a/autoload/braceless.vim +++ b/autoload/braceless.vim @@ -11,7 +11,7 @@ let s:pattern_cache = {} " Default patterns let s:pattern_default = {} let s:pattern_default.python = { - \ 'start': '\<\%(if\|def\|for\|try\|elif\|else\|with\|class\|while\|except\|finally\)\>\_.\{-}:\ze\s*\%(\_$\|#\)', + \ 'start': '\<\%(if\|async\|def\|for\|try\|elif\|else\|with\|class\|while\|except\|finally\)\>\_.\{-}:\ze\s*\%(\_$\|#\)', \ 'decorator': '\_^\s*@\%(\k\|\.\)\+\%((\_.\{-})\)\?\_$', \ 'end': '\S', \} diff --git a/test/selection.vader b/test/selection.vader index 97ef2ba..bb08a33 100644 --- a/test/selection.vader +++ b/test/selection.vader @@ -440,3 +440,33 @@ Expect python (innermost function replaced): def example(): x return example + + +Given python (async function): +========================================== + async def example(): + async with foo: + a + b + c + return 42 + +Do (replace inner block): +================================ + 3GciPx + +Expect python (innermost function replaced): +============================================ + async def example(): + async with foo: + x + return 42 + +Do (replace inner block): +================================ + ciPx + +Expect python (innermost function replaced): +============================================ + async def example(): + x