I'm trying to configure treesitter syntax highlighting for my neovim config but the docs only show examples with Lua and i am using Vimscript. If you're using VimScript they redirect you to an example of calling a Lua function within VimScript but I don't understand how it works.
From their docs:
Following examples assume that you are configuring neovim with lua. If you are using vimscript, see
:help lua-heredoc
. All modules are disabled by default and need to be activated explicitly in your init.lua, e.g., vialua-heredoc:
Executes Lua script {script} from within Vimscript. {endmarker} must NOT be preceded by whitespace. You can omit [endmarker] after the "<<" and use a dot "." after {script} (similar to |:append|, |:insert|). Example: > function! CurrentLineInfo() lua << EOF local linenr = vim.api.nvim_win_get_cursor(0)[1] local curline = vim.api.nvim_buf_get_lines( 0, linenr - 1, linenr, false)[1] print(string.format("Current line [%d] has %d bytes", linenr, #curline)) EOF endfunction Note that the `local` variables will disappear when the block finishes. But not globals.
I'd like to make this Lua code work in VimScript:
require("nvim-treesitter.configs").setup({
ensure_installed = { "javascript", "typescript", "lua", "vim", "json", "html", "rust", "tsx" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
},
})