diff --git a/home/.config/nvim/lua/plugins/plugin_list.lua b/home/.config/nvim/lua/plugins/plugin_list.lua index 2c2f10f..79d86f9 100644 --- a/home/.config/nvim/lua/plugins/plugin_list.lua +++ b/home/.config/nvim/lua/plugins/plugin_list.lua @@ -22,11 +22,16 @@ local plugin_list = { { "wakatime/vim-wakatime" }, { "mhinz/vim-startify" }, { "ryanoasis/vim-devicons" }, - { "sheerun/vim-polyglot", setup = get_plugin_file("polyglot.lua") }, { "vimwiki/vimwiki", config = get_plugin_file("vimwiki.lua") }, { "tpope/vim-commentary", config = get_plugin_file("commentary.lua") }, { "junegunn/fzf", run = function() fn['fzf#install']() end }, { "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", config = get_plugin_file("airline.lua"), diff --git a/home/.config/nvim/lua/plugins/settings/polyglot.lua b/home/.config/nvim/lua/plugins/settings/polyglot.lua deleted file mode 100644 index 53cb6c3..0000000 --- a/home/.config/nvim/lua/plugins/settings/polyglot.lua +++ /dev/null @@ -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'} diff --git a/home/.config/nvim/lua/plugins/settings/treesitter.lua b/home/.config/nvim/lua/plugins/settings/treesitter.lua new file mode 100644 index 0000000..7f90fe3 --- /dev/null +++ b/home/.config/nvim/lua/plugins/settings/treesitter.lua @@ -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()"