diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-06-11 19:39:07 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-06-11 19:39:07 +1000 |
| commit | 5a6fb51bdb43f15eafdbe1078183f754b4fecdf6 (patch) | |
| tree | d04d839f914cf95124ec8e586a7f1687b2a3a536 /rc/filetype | |
| parent | 17c25cc86a6bf4779f58fe2d2a5c13147bb27f2b (diff) | |
Tweak python block command test location and remove wall of text
We do not typically go into lengthy explanation of the code in the
support scripts. This would have a performance impact (as comments
are not trimmed in advance) and feels out of place.
Diffstat (limited to 'rc/filetype')
| -rw-r--r-- | rc/filetype/python.kak | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index 4b1a9c76..5f42a7de 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -167,24 +167,7 @@ define-command -hidden python-insert-on-new-line %{ evaluate-commands -itersel - execute-keys <semicolon> try %{ evaluate-commands -draft -save-regs '/"' %{ - # Handle block comment continuation/termination. - # - # This code applies in the context where we have a new line - # inserted, and the previous line is a block comment (i.e. a line - # that matches '^\h*#+\h*\S*$'). We assume that the comment will - # be continued, so we copy the prefix (all leading whitespace, any - # '#' characters, and then any additional whitespace before the - # next non-whitespace character) into the new line. - # - # PEP8's text on block comments says they can include an empty - # comment (i.e. '^\h*#+\h*$') as a paragraph separator - we - # leave a single empty comment as-is, to allow paragraph breaks, - # but if we see two consecutive empty comments we exit the - # comment block and delete the empty comments. - # Reference: https://peps.python.org/pep-0008/#block-comments - # - # first, make sure we're in the right context - don't wrap this - # in a try/catch so we fail out immediately + # Ensure previous line is a comment execute-keys -draft kxs^\h*#+\h*<ret> # now handle the coment continuation logic |
