diff --git a/rc/filetype/ocaml.kak b/rc/filetype/ocaml.kak index ffafcfe3..34024c01 100644 --- a/rc/filetype/ocaml.kak +++ b/rc/filetype/ocaml.kak @@ -97,3 +97,16 @@ define-command ocaml-alternative-file -docstring 'Switch between .ml and .mli fi } } + +# The OCaml comment is `(* Some comment *)`. Like the C-family this can be a multiline comment. +# +# Recognize when the user is trying to commence a comment when they type `(*` and +# then automatically insert `*)` on behalf of the user. A small convenience. +hook global WinSetOption filetype=ocaml %{ + hook window InsertChar '\*' %{ + try %{ + execute-keys -draft 'HH\(\*' + execute-keys ' *)' + } + } +}