Move to more performant syntax highlighting
This commit is contained in:
parent
c65ba7a9f6
commit
b35476dbde
@ -82,7 +82,40 @@ local function manage_plugins()
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- Syntax highlight
|
-- Syntax highlight
|
||||||
["https://github.com/bfrg/vim-cpp-modern.git"] = {},
|
["https://github.com/nvim-treesitter/nvim-treesitter.git"] = {
|
||||||
|
packadd_hook = function()
|
||||||
|
local conf = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
|
conf.setup {
|
||||||
|
-- only enable tested parsers
|
||||||
|
ensure_installed = { "c", "cpp", "lua", "rust" },
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
auto_install = false,
|
||||||
|
-- List of parsers to ignore installing (for "all")
|
||||||
|
ignore_install = {},
|
||||||
|
highlight = {
|
||||||
|
-- `false` will disable the whole extension
|
||||||
|
enable = true,
|
||||||
|
-- list of language that will be disabled
|
||||||
|
disable = {},
|
||||||
|
-- disable slow treesitter highlight for large files
|
||||||
|
disable = function(lang, buf)
|
||||||
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
|
local ok, stats =
|
||||||
|
pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- run `:h syntax` and tree-sitter at the same time.
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local manager = require("plogins").manage(plugins)
|
local manager = require("plogins").manage(plugins)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user