kommentary icon indicating copy to clipboard operation
kommentary copied to clipboard

Can't configure `gohtmltmpl` comments correctly

Open mrjones2014 opened this issue 3 years ago • 2 comments

When I use this config:

config.configure_language('default', {
  use_consistent_indentation = true,
  ignore_whitespace = true,
})
config.configure_language('gohtmltmpl', {
  prefer_multi_line_comments = true,
  single_line_comment_string = false,
  multi_line_comment_string = { '{{/*', '*/}}' },
})

And trigger kommentary in a gohtmltmpl file, it uses just /* */ as the comment string.

mrjones2014 avatar Aug 26 '21 12:08 mrjones2014

Hi, thanks for reporting.

What exactly is the extension of a gohtmltmpl file? Because when I open a file with the extension .gohtmltmpl, the filetype in nvim is set to nothing.

Try set filetype? in nvim and see if the filetype is actually called gohtmltmpl, if it's called something else simply change the name in the config, if the filetype is not set for these files, you should be able to define it with something like this autocmd BufRead,BufNewFile *.gohtmltmpl set filetype=gohtmltmpl in your init.vim.

Let me know if that helps.

b3nj5m1n avatar Aug 26 '21 18:08 b3nj5m1n

Sorry for the missing detail. gohtmltmpl is the filetype set by the vim-go plugin, for templates to be used with the Go HTML template package. Basically it uses {{ }} for Go code (not really Go code, more like a DSL) interpolation.

I have some custom detection code that, when opening a .html file, if the file contains {{ and }}, it overrides the filetype to gohtmltmpl.

Running set filetype? returns gohtmltmpl with this in place.

mrjones2014 avatar Aug 26 '21 18:08 mrjones2014