VHDL filetype: Fix if statement behavior.

This commit is contained in:
Michał Kruszewski 2022-08-15 13:41:07 +02:00
parent f3a05d41cb
commit ce18ac9918

View File

@ -182,7 +182,7 @@ define-command -hidden vhdl-insert-on-new-line %[
evaluate-commands %[ evaluate-commands %[
try %[ try %[
# Validate previous line and that it is not closed yet. # Validate previous line and that it is not closed yet.
execute-keys -draft kx <a-k>^\h*(?i)((then|(.*:\h*)?if\b.*\bthen)$)<ret> j}ijx <a-K>^<c-r>x(?i)end\b<ret> execute-keys -draft kx <a-k>^\h*(?i)((then|(.*:\h*)?if\b.*\bthen)$)<ret> j}ijx <a-K>^<c-r>x(?i)(elsif|else|end)\b<ret>
# Don't add for "if ... generate", it requires "end generate;". # Don't add for "if ... generate", it requires "end generate;".
execute-keys -draft kx <a-K>(?i)\bgenerate\b<ret> execute-keys -draft kx <a-K>(?i)\bgenerate\b<ret>
execute-keys -draft o<c-r>xend<space>if<semicolon><esc> execute-keys -draft o<c-r>xend<space>if<semicolon><esc>
@ -191,7 +191,7 @@ define-command -hidden vhdl-insert-on-new-line %[
# Wisely add "end generate;". # Wisely add "end generate;".
evaluate-commands %[ evaluate-commands %[
try %[ try %[
execute-keys -draft kx <a-k>^\h*(?i).*\bgenerate$<ret> j}ijx <a-K>^<c-r>x(?i)(begin|end|else)\b<ret> execute-keys -draft kx <a-k>^\h*(?i).*\bgenerate$<ret> j}ijx <a-K>^<c-r>x(?i)(begin|elsif|else|end)\b<ret>
# Don't add in case of comment line. # Don't add in case of comment line.
execute-keys -draft kx <a-K>^\h*--<ret> execute-keys -draft kx <a-K>^\h*--<ret>
execute-keys -draft o<c-r>xend<space>generate<semicolon><esc> execute-keys -draft o<c-r>xend<space>generate<semicolon><esc>