mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-12 20:19:10 +03:00
OCaml: Automatically insert closing comment when user starts a comment
An 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. Co-authored-by: Maxime Coste <mawww@kakoune.org>
This commit is contained in:
parent
459c6f589f
commit
8cfe59fcb0
@ -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<a-k>\(\*<ret>'
|
||||
execute-keys ' *)<left><left><left>'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user