mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 05:04:34 +00:00
Add treesitter AST semantic highlighting
This commit is contained in:
parent
1c3fc02877
commit
886b79e9a7
|
@ -22,11 +22,16 @@ local plugin_list = {
|
||||||
{ "wakatime/vim-wakatime" },
|
{ "wakatime/vim-wakatime" },
|
||||||
{ "mhinz/vim-startify" },
|
{ "mhinz/vim-startify" },
|
||||||
{ "ryanoasis/vim-devicons" },
|
{ "ryanoasis/vim-devicons" },
|
||||||
{ "sheerun/vim-polyglot", setup = get_plugin_file("polyglot.lua") },
|
|
||||||
{ "vimwiki/vimwiki", config = get_plugin_file("vimwiki.lua") },
|
{ "vimwiki/vimwiki", config = get_plugin_file("vimwiki.lua") },
|
||||||
{ "tpope/vim-commentary", config = get_plugin_file("commentary.lua") },
|
{ "tpope/vim-commentary", config = get_plugin_file("commentary.lua") },
|
||||||
{ "junegunn/fzf", run = function() fn['fzf#install']() end },
|
{ "junegunn/fzf", run = function() fn['fzf#install']() end },
|
||||||
{ "tomasiser/vim-code-dark", config = get_plugin_file("vim-code-dark.lua") },
|
{ "tomasiser/vim-code-dark", config = get_plugin_file("vim-code-dark.lua") },
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
config = get_plugin_file("treesitter.lua"),
|
||||||
|
run = ':TSUpdate',
|
||||||
|
requires = { "nvim-treesitter/playground", opt = true }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"vim-airline/vim-airline",
|
"vim-airline/vim-airline",
|
||||||
config = get_plugin_file("airline.lua"),
|
config = get_plugin_file("airline.lua"),
|
||||||
|
|
|
@ -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…
Reference in a new issue