0

neovim に vim-plug を用いて nvim-treesitter をインストールし, :TSInstall:TSUpgrade などのコマンドを叩くと, E492: エディタのコマンドではありませんというエラーが出てしまいます.

nvim-treesitter 自体のインストールは問題なく完了し, :checkhealthでも問題があるようには見えません.
どのようにしたらこれらのコマンドが使えるようになるでしょうか.

nvim-treesitterに関するcheckhealth:
checkhealth1

vim.treesitterに関するcheckhealth:
checkhealth2

neovim:

:version
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@HMBRW-A-001-M1-002.local

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

      システム vimrc: "$VIM/sysinit.vim"
       省略時の $VIM: "/opt/homebrew/Cellar/neovim/0.7.0/share/nvim"

treesitter自体はhomebrewを使ってインストールしました.

1
  • 結局devバージョンに変更してもtreesitterが使えるようにならなかったので、 nvim.initを全てluaで書き直し、luaのプラグインを入れてneovim環境を刷新しました。
    – Tomoki
    2022年10月3日 2:19

2 件の回答 2

0

僕も0.7にした途端、様々な不具合が出ました。
OgaKen さんの回答 を試しても治りませんでした。

ただ、neovim nightly のバージョンにアップデートしたらすべてのエラーが解決して問題なく使えるようになりました。
一度試してみてはいかがでしょう。

1
  • 回答ありがとうございます。 やはり、nightlyバージョンにアップデートする必要があるのですね。 nvim-treesitterのgithubではあくまでも'recommended'とだけあるので、通常バージョンでもいけるものだと期待(横着)していました。 とりあえず今はSemshiを使って作業しています。プロジェクトが落ち着いたらnightlyバージョンに変更試してみたいと思います。
    – Tomoki
    2022年5月14日 13:53
0

init.vim に以下を追記してみてください。

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

追記

lua require('plugin').setup()を書いていないから動かないものと思って上記の回答を書きましたが、そもそもnvim-treesitterについては不要だったので、完全に間違いです。

同様の現象を手元で再現させようとしましたが、できませんでした。(:TSInstallなどのコマンドは使用可能な状態でした。)
私が再現させるために使用した環境は以下です。

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
  • 設定ファイル:

init.vim

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

if &runtimepath !~# '/dein.vim'
    const s: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

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

    const s: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'
3
  • これはうまくいきませんでしたか?
    – OgaKen
    2022年5月10日 13:04
  • 回答ありがとうございます。遅れてしまってすみません。 nivm-treesitter.configsは色々と試してみましたが、ダメでした。
    – Tomoki
    2022年5月14日 13:47
  • 手元で確認したのですが、再現できませんでした。 回答を編集したので、少しでも参考になればと思います。
    – OgaKen
    2022年5月15日 17:59

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。