summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCormac Stephenson <c7s@kasku.net>2024-01-15 02:59:04 +0000
committerCormac Stephenson <c7s@kasku.net>2024-01-15 03:15:42 +0000
commit3beeda7bcc3f06269dcb0ce2b5891e2735563a8b (patch)
tree38184ffa23d4c23e12e2efee2b5a5dc7ddc2f877
parentea930664ad13052c1a89af75ccdefd5368df906a (diff)
ocaml.kak: give a name to the hook which inserts comment characters
This lets set-option window disabled_hooks .*-insert work as expected.
-rw-r--r--rc/filetype/ocaml.kak11
1 files changed, 5 insertions, 6 deletions
diff --git a/rc/filetype/ocaml.kak b/rc/filetype/ocaml.kak
index f41111c5..0c7986c4 100644
--- a/rc/filetype/ocaml.kak
+++ b/rc/filetype/ocaml.kak
@@ -14,6 +14,7 @@ hook global BufCreate .*\.(ml|mli|mll|mly)$ %{
hook global WinSetOption filetype=ocaml %{
require-module ocaml
set-option window static_words %opt{ocaml_static_words}
+ hook window InsertChar -group ocaml-insert '\*' ocaml-insert-closing-comment-bracket
}
hook -group ocaml-highlight global WinSetOption filetype=ocaml %{
@@ -102,11 +103,9 @@ define-command ocaml-alternative-file -docstring 'Switch between .ml and .mli fi
#
# 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<a-k>\(\*<ret>'
- execute-keys ' *)<left><left><left>'
- }
+define-command -hidden ocaml-insert-closing-comment-bracket %{
+ try %{
+ execute-keys -draft 'HH<a-k>\(\*<ret>'
+ execute-keys ' *)<left><left><left>'
}
}