diff --git a/rc/filetype/vhdl.kak b/rc/filetype/vhdl.kak index 78d00389..bceab2f2 100644 --- a/rc/filetype/vhdl.kak +++ b/rc/filetype/vhdl.kak @@ -197,12 +197,12 @@ define-command -hidden vhdl-insert-on-new-line %[ execute-keys -draft oxendgenerate ] ] - # Wisely add "end case;". + # Wisely add "when" and "end case;". evaluate-commands %[ try %[ # TODO: Case needs special handling. - execute-keys -draft kx ^\h*(?i)(case|.*\h*:\h*case)\b }ix ^x(?i)(end|when) - execute-keys -draft oxendcase + execute-keys -draft kx ^\h*(?i)(case|.*\h*:\h*case)\b jwx ^x(?i)(end|when) + execute-keys -draft xoxendcasekAwhen ] ] # Wisely add "begin" and "end block;". @@ -250,7 +250,6 @@ define-command -hidden vhdl-insert-on-new-line %[ # Wisely add ");" for "type ... is (". evaluate-commands %[ try %[ - # FIXME: There is some problem. execute-keys -draft kx ^\h*(?i)(type\b.*\bis\h+\(\h*)$ j}ijx ^x(\)) execute-keys -draft ox) ] @@ -385,26 +384,17 @@ define-command -hidden vhdl-indent-on-new-line %{ # Increase indent after some keywords. try %[ execute-keys -draft kx (?i)\b(begin|block|body|else|for|generate|if|is|loop|process|protected|record|select|then)$ - # Does not indent if in comment line. + # Do not indent if in comment line. execute-keys -draft kx(?i)^\h*-- - # Handle case line in a bit different way. - execute-keys -draft kx(?i)^\h*case\b + # Do not indent for "case ... is". + execute-keys -draft kx^\h*(?i)(case|.*\h*:\h*case)\b execute-keys -draft ] - - # Add "when " after "case ... is". - try %[ - execute-keys -draft kx (?i)\h*case\b.*\h+is$ - # Don't indent if in comment line. - execute-keys -draft kx(?i)^\h*-- - execute-keys -draft iwhen - ] - # Copy the indentation of the matching if. try %{ execute-keys -draft , k x ^\h*(elsif\b|else$) gh [c^\h*(\S*\h*:\h*)?if\b,\bend\sif\b x 1 , j K } # Increase indent after some operators. - try %[ execute-keys -draft , k x (\(|=>|<=|:=)$ j ] + try %[ execute-keys -draft k x (\(|=>|<=|:=)$ j ] } }