VHDL filetype: Wisely add "end protected body;".

This commit is contained in:
Michał Kruszewski 2022-02-09 11:08:45 +01:00
parent 0b29fcf32a
commit 8b6221e97f

View File

@ -232,6 +232,13 @@ define-command -hidden vhdl-insert-on-new-line %[
execute-keys -draft o<c-r>xend<space>protected<semicolon><esc>
]
]
# Wisely add "end protected body;".
evaluate-commands %[
try %[
execute-keys -draft k<a-x> <a-k>^(?i)(\h*type\h+\w+\h+is\h+protected\h+body$)<ret> }i<a-x> <a-K>^<c-r>x(?i)end\h+protected\h+body\b<ret>
execute-keys -draft o<c-r>xend<space>protected<space>body<semicolon><esc>
]
]
# Wisely add "end record;".
evaluate-commands %[
try %[
@ -375,7 +382,7 @@ define-command -hidden vhdl-indent-on-new-line %{
# Increase indent after some keywords.
try %[
execute-keys -draft k<a-x><a-k> (?i)\b(begin|block|else|for|generate|if|is|loop|process|protected|record|select|then)$ <ret>
execute-keys -draft k<a-x><a-k> (?i)\b(begin|block|body|else|for|generate|if|is|loop|process|protected|record|select|then)$ <ret>
# Does not indent if in comment line.
execute-keys -draft k<a-x><a-K>(?i)^\h*--<ret>
# Handle case line in a bit different way.