Matchup in Neovim for Go templates
After dealing with Go templates (also HTML templates) for more
than a year and keep loosing track of where each block {{end}}s
I finally did something about
it.
But that didn’t work that good. So I’ve switch to the
match-up plugin, which is better than the built-in
matchit
that I was using previously. With Neovim I’m using this setup:
Plug 'andymass/vim-matchup'
And this extra bit of config:
require'nvim-treesitter.configs'.setup {
matchup = {
enable = true,
},
}
This in itself does not make template matching work, for this I just copied the Hugo template matcher (which is just like Go templating) to the correct place. Doing this with some automation from inside Neovim:
let vim_after=expand('~/.config/nvim/after/ftplugin')
if !isdirectory(vim_after)
silent execute "!mkdir -p ~/.config/nvim/after/ftplugin"
silent execute "!cp ~/.dotfiles/after/* ~/.config/nvim/after/ftplugin/"
endif
Read other posts