vim-matchup
vim-matchup copied to clipboard
Add support for hugo templates and golang
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 -}}
Hey, is there any filetype for hugo files? Do you use any plugin to support hugo files?
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 what are you looking to be matched in go?
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.
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