0

(I have TComment installed, and I'm on NeoVim 0.4.0.)

Given this code, for example:

let mem key st =
   let is_matching_key = function
   | Positional _ -> false
   | Flag f -> f.name == key
   in
   (* FIXME: This is slow, but Array.exists isn't available until OCaml 4.03, and I am lazy. *)
   List.exists is_matching_key (Array.to_list st.args)

When I select the above code, and hit gcc, I get:

(* let mem key st = *)
(*    let is_matching_key = function *)
(*    | Positional _ -> false *)
(*    | Flag f -> f.name == key *)
(*    in *)
(*    (* FIXME: This is slow, but Array.exists isn't available until OCaml 4.03, and I am lazy. *) *)
(*    List.exists is_matching_key (Array.to_list st.args) *)
(*  *)

Instead, I'd like to get something like,

(* let mem key st =
   let is_matching_key = function
   | Positional _ -> false
   | Flag f -> f.name == key
   in
   (* FIXME: This is slow, but Array.exists isn't available until OCaml 4.03, and I am lazy. *)
   List.exists is_matching_key (Array.to_list st.args) *)

… where there are only comment-delimiters at the beginning and end of the entire text.

How do I achieve this?


Additionally — I'd like to get Vim to continue to maintain this indent-style when hitting Return inside docblocks. If is the insertion-point in the following text …

(** This is a documentation-block for this function.⁁

… I currently get this after hitting Return

(** This is a documentation-block for this function.
 * ⁁

(Note the additional asterisk it's adding on each line; also note that the indentation is ‘one off’, not aligning with the T in the above line.) I'd like to get this:

(** This is a documentation-block for this function.
    ⁁

I've tried to pore thru the TComment documentation, but I'm having no luck improving this behaviour.

2
  • I think your question would deserve to be split in two different questions: The first one about how to comment a block of text with TComment (note that asking it directly on the plugin's issue tracker could be a good option for you), The second about how to change the comment indentation behavior (and for that I think we might have some duplicates, you can also have a read at :h 'cindent' and :h 'cinoptions')
    – statox
    Commented Feb 28, 2019 at 14:13
  • Unfortunately, 'cindent' isn't turned on in OCaml buffers — I thought that behaviour might be from TComment? Maybe it's something else. Commented Feb 28, 2019 at 19:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.