I installed nvim-treesitter, but I can't use commands such as TSInstall.E492

Asked 2 years ago, Updated 2 years ago, 179 views

If you install nvim-treesitter on neovim using vim-plug and hit commands such as :TSInstall or :TSUpgrade, you will get the error E492:Not Editor's command.

The installation of nvim-treesitter itself has been successfully completed, and :checkhealth does not appear to be a problem.
How do I get to use these commands?

checkhealth for nvim-treesitter:
checkhealth1

checkhealth for vim.treesitter:
checkhealth2

neovim:

:version
NVIM v0.7.0
Build type:Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl+iconv+tui
See":help feature-compile"

      System vimrc: "$VIM/sysinit.vim"
       Abbreviated $VIM: "/opt/homebrew/Cellar/neovim/0.7.0/share/nvim"

I installed the treesitter itself using homebrew.

vim neovim

2022-09-30 19:27

2 Answers

As soon as I set it to 0.7, there were many problems.
I tried OgaKen's answer, but it didn't work.

However, after updating to the neovim nightly version, all errors were resolved so that it could be used without any problems.
Why don't you give it a try?


2022-09-30 19:27

Try adding the following to init.vim

lua<<EOF
require 'nvim-treesitter.configs'.setup{
    sense_installed = 'all',
    highlight = { enable = true },
}
EOF

Additional information

lua require('plugin').setup() was not written, so I thought it wouldn't work, so I wrote the answer above, but nvim-treesitter was not required in the first place, so it's completely wrong.

I tried to reproduce the same phenomenon at hand, but I couldn't.(Commands such as :TSInstall were available.)
The environment I used to reproduce is as follows.

NVIM v0.7.0
Build type:Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az316-460

Features: +acl+iconv+tui
See":help feature-compile"

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

Run—checkhealth for more info
  • nvim-treesitter:c9ebd16c
  • configuration files:

init.vim

consts:cache_home=empty($XDG_CACHE_HOME)?expand('~/.cache'):$XDG_CACHE_HOME

if&runtimepath!~#'/dein.vim'
    consts:dein_dir=s:cache_home.'/dein/repos/github.com/Shougo/dein.vim'
    if!isdirectory(s:dein_dir)
        execute printf('!git clone https://github.com/Shougo/dein.vim.git%s',s:dein_dir)
    endif
    execute printf('set runtimepath^=%s', substitute(fnamemodify(s:dein_dir, ':p'), '[/\\]$', '', ')))
endif

consts:path=s:cache_home.'/dein'
if dein#load_state(s:path)
    consts:base_dir=fnamemodify(expand($MYVIMRC), ':h')

    consts:deintoml=s:base_dir.'/dein.toml'

    call dein# begin(s:path, [$MYVIMRC, s:deintoml])
    
    call dein#load_toml(s:deintoml)

    call dein#end()
    call dein#save_state()
endif

if dein#check_install()
    call dein# install()
endif

filetype plugin indent on
syntax enable

dein.toml

[plugins]]
repo='Shougo/dein.toml'
lazy=false

[[plugins]]
repo='nvim-treesitter/nvim-treesitter'
lazy=true
on_evnet='BufReadPost'


2022-09-30 19:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.