Xinqi Bao's Git

update bashrc for cargo env
[dotfiles.git] / .config / nvim / lua / plugin-config / nvim-treesitter.lua
1 require'nvim-treesitter.configs'.setup {
2 --[[
3 ]]
4 -- A list of parser names, or "all" (the five listed parsers should always be installed)
5 ensure_installed = {
6 "c", "cpp", "python", "lua", "bash",
7 "cmake", "make",
8 "json", "yaml",
9 "vim", "vimdoc",
10 "query", "regex", "comment", "markdown",
11 },
12
13 -- Install parsers synchronously (only applied to `ensure_installed`)
14 sync_install = false,
15
16 -- Automatically install missing parsers when entering buffer
17 -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
18 auto_install = false,
19
20 -- List of parsers to ignore installing (or "all")
21 ignore_install = { "javascript" },
22
23 ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
24 -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
25
26 highlight = {
27 enable = true,
28
29 -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
30 -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
31 -- the name of the parser)
32 -- list of language that will be disabled
33 disable = { "c", "rust" },
34 -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
35 disable = function(lang, buf)
36 local max_filesize = 100 * 1024 -- 100 KB
37 local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
38 if ok and stats and stats.size > max_filesize then
39 return true
40 end
41 end,
42
43 -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
44 -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
45 -- Using this option may slow down your editor, and you may see some duplicate highlights.
46 -- Instead of true it can also be a list of languages
47 additional_vim_regex_highlighting = false,
48 },
49
50 -- Incremental selection based on the named nodes from the grammar.
51 incremental_selection = {
52 enable = true,
53 keymaps = {
54 init_selection = '<CR>',
55 node_incremental = '<CR>',
56 node_decremental = '<BS>',
57 scope_incremental = '<TAB>',
58 }
59 },
60
61 -- Indentation based on treesitter for the = operator. NOTE: This is an experimental feature.
62 indent = {
63 enable = false
64 }
65 }