glts / vim-textobj-comment

Vim text objects for comments
http://www.vim.org/scripts/script.php?script_id=4570
130 stars 8 forks source link

Doesn't work for OCaml #3

Closed rgrinberg closed 9 years ago

rgrinberg commented 9 years ago

E.g.

(* try vic in this comment *)

My commentstring seems to be set correctly: (*%s*)

EDIT: I forgot to mention that it does work for other file types.

glts commented 9 years ago

Hm, works on my end. Vim version 7.4.712.

I save the following text as world.ml.

(* Simple "Hello world" program. *)
print_string "Hello world\n"

Opening this file, I get these settings after automatic filetype detection:

:set filetype? comments? commentstring?
  filetype=ocaml
  comments=sr:(*,mb:*,ex:*)
  commentstring=/*%s*/

Unlike some other comment plugins, textobj-comment looks at the 'comments' setting first. 'commentstring' is only used as a fall-back. I did it this way to support languages that have both simple and "paired" comment delimiters (think // ... and /* ... */ and /** ... */ in C-likes).

Check if the filetype is detected correctly. Then make sure 'comments' has a useful value, or make it empty to fall back to your 'commentstring' setting.

rgrinberg commented 9 years ago

OK I made it empty and it seems to work. Strangely enough, I'm also getting a strange incompatibility with tcomment but only for OCaml files.

That has nothing to do with this plugin though. Thanks!