mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-30 12:30:43 +00:00
Add treesitter AST semantic highlighting
This commit is contained in:
parent
1c3fc02877
commit
886b79e9a7
3 changed files with 34 additions and 9 deletions
|
@ -1,8 +0,0 @@
|
|||
local vim = require("vim")
|
||||
local g = vim.g
|
||||
|
||||
-- Disable polyglot's "sensible" settings, while there are some nice things it
|
||||
-- does, I set these manually in my default config and I don't like depending
|
||||
-- on single plugin for so many things, doing it manually doing it manually is
|
||||
-- also more explicit making it obvious what's happening
|
||||
g.polyglot_disabled = {'sensible'}
|
28
home/.config/nvim/lua/plugins/settings/treesitter.lua
Normal file
28
home/.config/nvim/lua/plugins/settings/treesitter.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
local vim = require("vim")
|
||||
local g = vim.g
|
||||
|
||||
-- Enable treesitter highlight for all languages
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- Always automatically install parsers for these languages
|
||||
ensure_installed = {
|
||||
"bash", "python", "lua", "rust", "go", "haskell",
|
||||
"c", "cpp", "cmake", "c_sharp", "java", "dockerfile",
|
||||
"json", "toml", "yaml", "regex", "vim", "html", "css",
|
||||
"typescript", "javascript",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
-- Use git instead of curl for downloading parsers
|
||||
require("nvim-treesitter.install").prefer_git = true
|
||||
|
||||
-- Use treesitter for syntax-aware folding
|
||||
g.foldmethod = "expr"
|
||||
g.foldexpr = "nvim_treesitter#foldexpr()"
|
Loading…
Add table
Add a link
Reference in a new issue