diff options
| -rw-r--r-- | .config/nvim/lazy-lock.json | 2 | ||||
| -rw-r--r-- | .config/nvim/lua/vimrc/plugins.lua | 43 | ||||
| -rw-r--r-- | flake.nix | 7 |
3 files changed, 24 insertions, 28 deletions
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 8c2430c..e26082b 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -10,7 +10,7 @@ "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, "nvim-lspconfig": { "branch": "master", "commit": "463b16bd6a347a129367a7fd00ebcdd9442d9a96" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter": { "branch": "main", "commit": "75797cdd8ac125c7ace065b17788b439dcf89a71" }, "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, diff --git a/.config/nvim/lua/vimrc/plugins.lua b/.config/nvim/lua/vimrc/plugins.lua index 217f21c..9cbe3ae 100644 --- a/.config/nvim/lua/vimrc/plugins.lua +++ b/.config/nvim/lua/vimrc/plugins.lua @@ -307,36 +307,25 @@ return { -- Tree-sitter integration. { 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdateSync', + branch = 'main', + build = ':TSUpdate', config = function() - require('nvim-treesitter.configs').setup { - ensure_installed = 'all', - sync_install = false, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - --[[ - incremental_selection = { - enable = true, - keymaps = { - init_selection = 'TODO', - node_incremental = 'TODO', - scope_incremental = 'TODO', - node_decremental = 'TODO', - }, - }, - --]] - indent = { - enable = true, - }, - } + require('nvim-treesitter').setup({}) + vimrc.autocmd('FileType', { + callback = function(ctx) + local ok = pcall(vim.treesitter.start) + if not ok then + return + end + vim.o.indentexpr = 'v:lua.require("nvim-treesitter").indentexpr()' + if vim.o.foldmethod == 'manual' then + vim.o.foldmethod = 'expr' + vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()' + end + end, + }) end, }, - -- Tree-sitter debugging. - { - 'nvim-treesitter/playground', - }, -- Highlight specified words. { 't9md/vim-quickhl', @@ -39,6 +39,13 @@ in { formatter = treefmt.config.build.wrapper; + + devShells.default = pkgs.mkShell { + packages = [ + # For generating nvim-treesitter parsers. + pkgs.tree-sitter + ]; + }; } ) // { |
