Closed m-kru closed 3 years ago
I have problem with defining proper behavior of some file type command when auto-pairs is enabled. I have following command defined
define-command -hidden vhdl-insert-on-new-line %[ evaluate-commands -save-regs x %[ # Save previous line indent in register x. try %[ execute-keys -draft k<a-x>s^\h+<ret>"xy ] catch %[ reg x '' ] # Wisely add ");" for "generic (". evaluate-commands %[ try %[ execute-keys -draft k<a-x> <a-k>^\h*(?i)generic\h*\($<ret> }i<a-x> <a-K>^<c-r>x(\)\;)<ret> execute-keys -draft o<c-r>x)<semicolon><esc> ] ] ]
When auto-pairs is not enabled, after inserting following sequence
generic (
and hitting enter I end up with:
generic ( <- cursor here );
When auto-pairs is enabled I always end up with:
generic ( <- cursor here )
The ; is missing in the last line. The cursor in both cases is indented one more level, but this is expected and is the result of another command.
;
I have tried multiple methods to get this command work properly both with and without auto-pairs, but I failed. Can you help?
Does it still happen with the new version?
I have problem with defining proper behavior of some file type command when auto-pairs is enabled. I have following command defined
When auto-pairs is not enabled, after inserting following sequence
and hitting enter I end up with:
When auto-pairs is enabled I always end up with:
The
;
is missing in the last line. The cursor in both cases is indented one more level, but this is expected and is the result of another command.I have tried multiple methods to get this command work properly both with and without auto-pairs, but I failed. Can you help?