Commit Graph

4 Commits

Author SHA1 Message Date
zeertzjq
12c9791e0f
fix(runtime): stop treesitter highlight in b:undo_ftplugin (#29533)
It seems that nvim-treesitter stops treesitter highlight when changing
filetype, so it makes sense for builtin ftplugins to do this as well.

Use :call and v:lua here to allow separation with '|'.
2024-07-03 15:24:12 +08:00
Christian Clason
f69658bc35
feat(treesitter): highlight Lua files by default (#26824) 2024-01-01 15:37:07 +01:00
Christian Clason
2e450efb95
feat(treesitter)!: remove g:ts_highlight_lua (#22257)
This variable was only meant for easy testing during the development
cycle for treesitter highlighting while Lua was the only parser useable
for daily driving. Now that we have a good vimdoc parser, this approach
simply doesn't scale and should be removed sooner rather than later.

Instead of setting this variable, people for now should add the autocommand
directly to their config:
```lua
vim.api.nvim_create_autocmd('FileType', {
  pattern = 'lua', -- or { 'lua', 'help' }
  callback = function() vim.treesitter.start() end,
})
```
(or put `vim.treesitter.start()` in an `ftplugin`).
2023-02-15 09:55:23 +01:00
Christian Clason
0822896efc feat(treesitter): add vim.treesitter.start(), enable for Lua
* Add vim.treesitter.start() for starting treesitter highlighting via
  ftplugin or autocommand (can be extended later for fold, indent,
  matchpairs, ...)
* Add vim.treesitter.stop() for manually stopping treesitter
  highlighting
* Enable treesitter highlighting for Lua if
  `vim.g.ts_highlight_lua = true` is set in `init.lua`
2022-09-06 08:08:29 +02:00