0

I'm trying to install treesitter nvim.I do everything according to the documentation, but nothing works. google does not provide any useful information on these errors. My packer.lua file:

vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function(use)
  -- Packer can manage itself
  use 'wbthomason/packer.nvim'

  use {
          'nvim-telescope/telescope.nvim', tag = '0.1.1',
          requires = { {'nvim-lua/plenary.nvim'} }
  }

  use({ 'rose-pine/neovim', as = 'rose-pine' })

  vim.cmd('colorscheme rose-pine')

  use {
          'nvim-treesitter/nvim-treesitter',
          run = function()
                  local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
                  ts_update()
          end,
  }

  use("nvim-treesitter/playground")
end)

My after/plugin/treesitter.lua file:

require'nvim-treesitter.configs'.setup {
  -- A list of parser names, or "all"
  ensure_installed = { "vimdoc", "javascript", "typescript", "vim", "query", "c", "lua", "rust" },

  -- Install parsers synchronously (only applied to `ensure_installed`)
  sync_install = false,

  -- Automatically install missing parsers when entering buffer
  -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
  auto_install = true,

  highlight = {
    -- `false` will disable the whole extension
    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,
  },
}

When i typed :so in treesitter.lua I see errors:

nvim-treesitter[query]: Failed to execute the following command:
{
  cmd = "mv",
  opts = {
    args = { "-f", "tree-sitter-query-tmp/tree-sitter-query-3a9808b22742d5bd906ef5d1a562f2f1ae57406d", "tree-sitter-query" },
    cwd = "/home/kirill/.local/share/nvim",
    stdio = {
      [2] = <userdata 1>,
      [3] = <userdata 2>
    }
  }
}
mv: cannot stat 'tree-sitter-query-tmp/tree-sitter-query-3a9808b22742d5bd906ef5d1a562f2f1ae57406d': No such file or directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Creating temporary directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Creating temporary directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Creating temporary directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Creating temporary directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Creating temporary directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Creating temporary directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Creating temporary directory
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Extracting tree-sitter-typescript...
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Extracting tree-sitter-lua...
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Extracting tree-sitter-c...
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Extracting tree-sitter-vimdoc...
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Extracting tree-sitter-vim...
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Extracting tree-sitter-javascript...
Press ENTER or type command to continue
[nvim-treesitter] [1/8, failed: 1] Extracting tree-sitter-rust...
nvim-treesitter[typescript]: Failed to execute the following command:
{
  cmd = "mv",
  opts = {
    args = { "-f", "tree-sitter-typescript-tmp/tree-sitter-typescript-286e90c32060032225f636a573d0e999f7766c97", "tree-sitter-typescript" },
    cwd = "/home/kirill/.local/share/nvim",
    stdio = {
      [2] = <userdata 1>,
      [3] = <userdata 2>
    }
  }
}
mv: cannot stat 'tree-sitter-typescript-tmp/tree-sitter-typescript-286e90c32060032225f636a573d0e999f7766c97': No such file or directory
....

I can't find solution. My nvim version:

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

:checkhealth treesitter


==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14

:checkhealth nvim-treesitter

nvim-treesitter: require("nvim-treesitter.health").check()

Installation
- OK tree-sitter found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
- OK node found v19.8.1 (only needed for :TSInstallFromGrammar)
- OK git executable found.
- OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 12.2.1 20230201
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.1.25-1-MANJARO",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Thu Apr 20 13:48:36 UTC 2023"
}

Parser/Features         H L F I J

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}
  • Some questions in order to help you: What version of nvim are you using? Do you meet the treesitter [requiments](https://github.com/nvim-treesitter/nvim-treesitter#requirements)? Try also `:checkhealth treesitter` – Rico May 23 '23 at 23:36
  • @Rico I have updated my question with the information you need – Kirill Stepankov May 24 '23 at 06:18
  • @Rico the error output says that the archives are unpacked to folders in .local/share/nvim, but in fact, if I go to this directory, the archives are there, but they are not unpacked. – Kirill Stepankov May 24 '23 at 07:28
  • Can you try putting `require("nvim-treesitter.install").prefer_git = true` in the first line of your packer nvim-treesitter run function? `run = function()` – Rico May 24 '23 at 11:59
  • @Rico still the same errors – Kirill Stepankov May 24 '23 at 14:39
  • It seems your `tar` and `curl` commands don't work and they are being used in the installation process. That's why the archives are not unpacked. – Rico May 24 '23 at 16:52

0 Answers0