diff options
author | Marc Coquand <marc@mccd.space> | 2024-05-15 19:47:21 -0500 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2024-05-15 19:47:21 -0500 |
commit | 9536a4c2b46e6851db41bab2806c7bdeee8edbb8 (patch) | |
tree | 5a7be6c2376ed92884557d0257d0ed8c3dc1e796 /config/kak/ocaml-snippets.kak | |
parent | d09be0d5ced1b31e40a1114581abfce0db06c540 (diff) | |
download | rcm-9536a4c2b46e6851db41bab2806c7bdeee8edbb8.tar.gz rcm-9536a4c2b46e6851db41bab2806c7bdeee8edbb8.tar.bz2 rcm-9536a4c2b46e6851db41bab2806c7bdeee8edbb8.zip |
Add kak and more
Diffstat (limited to '')
-rw-r--r-- | config/kak/ocaml-snippets.kak | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/config/kak/ocaml-snippets.kak b/config/kak/ocaml-snippets.kak new file mode 100644 index 0000000..0d48bee --- /dev/null +++ b/config/kak/ocaml-snippets.kak @@ -0,0 +1,35 @@ +set buffer snippets %opt{snippets} # keep global snippets (if any) +set -add buffer snippets 'Import Html libs' 'html-imp' %{ snippets-insert %{let open Dream_html in +let open HTML in + } + } +set -add buffer snippets 'Create form' 'letform-' \ + %{ phantom-selection-clear ; snippets-insert %{let form ~csrf req = + match%lwt Dream.form ~csrf req with + | `Ok [ ("${}", ${}); ] -> + Lwt_result.return (${}) + | e -> Lwt_result.fail (`Form e) + ${} +}; phantom-selection-add-selection ; phantom-selection-iterate-next } + +set -add buffer snippets 'Create user form (base)' 'form-b' \ + %{ snippets-insert %{null + [ h2 [] [txt "${}"] + ; form + [ id "${}"; action "/${}"; method_ `POST ] + [ csrf_tag req + ; br [] + ] + ] +}; } + +set -add buffer snippets 'Create user form (text field)' 'form-tf' \ + %{ snippets-insert %{; label [ for_ "${}" ] [ txt "${}" ] + ; input [ id "${}"; name "${}"; type_ "text" ] + ; br [] +}; } + +set -add buffer snippets 'Create user form (submit)' 'form-s' \ + %{ snippets-insert %{; button [type_ "submit"] [ txt "${}" ] +}; } + |