Skip to content

ngynkvn/gotmpl.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note

This is intended to be kept as a proof of concept, please adapt the example to your specific situation

gotmpl.nvim

Editing Go template files (.tmpl) in Neovim lacks accurate syntax highlighting, making the code harder to read and maintain.

This plugin adds treesitter support to separate go template syntax from the host language syntax. It is very simple for now, it checks the file name ends with a format like .$FT.tmpl, then sets it as @injection.language = $FT for treesitter.

Installation

-- lazy.nvim --
{ "ngynkvn/gotmpl.nvim", opts = {}}

Usage

Once installed, Treesitter will automatically highlight Go template files. Simply open a .tmpl file, and you should see improved syntax highlighting. If your file type isn’t detected correctly, you can manually set it:

:set filetype=gotmpl

References

About

Proper syntax highlighting for Go templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published