vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

Add support for hugo templates and golang

Open boydkelly opened this issue 4 years ago • 4 comments
trafficstars

Would be awesome if match-up supported html templates in hugo (and probably all of golang) with constructs using range/end or with/end and others as per below. Great plugin. Thanks!

{{ range .Site.Params.customcss -}}

{{- end }}

{{ with .OutputFormats.Get "rss" -}}
{{ printf <link rel="%s" type="%s" href="%s" title="%s" /> .Rel .MediaType {{ end -}}

boydkelly avatar Dec 03 '20 08:12 boydkelly

Hey, is there any filetype for hugo files? Do you use any plugin to support hugo files?

andymass avatar Dec 03 '20 23:12 andymass

Hey, is there any filetype for hugo files? Do you use any plugin to support hugo files?

Is there a configured b:match_words variable for golang, there is no relevant configuration on google search

yyy33 avatar Jan 04 '22 07:01 yyy33

@yyy33 what are you looking to be matched in go?

andymass avatar Jan 04 '22 22:01 andymass

I have not found a filetype plugin yet that supports hugo. But you can add your own support in your configurations easily.

For example, if you want hugo to be highlighted in html files, add the following to a file called ~/.vim/after/ftplugin/html.vim or ~/.config/nvim/after/ftplugin/html.vim with the contents

let s:block_start = '\(define\|block\|with\|range\|if\)'
call matchup#util#append_match_words(
      \ '{{-\?\s*' . s:block_start . '.\{-}\s*-\?}}'
      \ . ':{{-\?\s*end\s*-\?}}')
call matchup#util#append_match_words('{{:}}')

The regular expressions can be customized as needed.

andymass avatar Jan 08 '22 17:01 andymass

The Go language is supported only in neovim + Treesitter, it cannot be supported using regex.

Hugo works as described. Also described in wiki https://github.com/andymass/vim-matchup/wiki/The-match-up-wiki

andymass avatar Nov 11 '22 01:11 andymass