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.

migrated from superuser.com Feb 27 at 21:21

This question came from our site for computer enthusiasts and power users.

  • 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 Feb 28 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. – ELLIOTTCABLE Feb 28 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.