A new type of snippets plugin

@andreyorst how about your Mapping sequence of keys in insert mode to trigger kak’s register → execute-keys → snippets.

With snippets being the work of the below.

Would this work Andrey??

Mate, I had no idea. Thank you for the info.
So here is where I’m at and currently stuck. As my kakoune register skills need improvement.

The sequence of events are:

  1. activate snippet trigger on .keyword
  2. escape to normal mode
  3. extend to previous . inclusive
  4. delete
  5. select to previous word start
  6. save to register
  7. delete selected text
  8. do snippet
  9. paste saved register into first tabstop position
  10. if next tabstop then advance
  11. else advance to end of line
  12. enter insert mode
  13. end sequence
Main.class<esc><a-f>.db"0y
do snippet
<c-r>0  paste saved register into first slot
<tab>   advance onto next tab position

where *.class snippets is:

class ${1:Name} {
    ${0:// body}
}

If I can get one going then I’m off and running to postfix glory :smile:. Grateful for any help guys. Bye :wave:


I’m thinking that wrapping the snippets function will allow a way to define a subset of snippets as a trigger and or alternate sequence of execute-keys on a subset of those snippets.

define-command postfix-snippets-wrap %{
  execute-keys '<a-t>."syHdb"kyc'
  execute-keys '<a-;>: snippets-expand-or-jump %val{main_reg_s}'
  execute-keys '<a-;>d<c-r>k'
  execute-keys '<tab><a-;>d'
}

To be continued…

How are your travels going with the tangent @robertmeta?