Neovim:没有使用 Treesitter 进行 Markdown 语法高亮显示

问题描述 投票:0回答:1

它实际上适用于 Kickstart 设置,但一旦我将

coloscheme
更改为其他任何内容,它就会停止工作。 AppImage 发行版附带的配色方案似乎都没有突出显示简单的 Markdown,也没有突出显示带有 YAML“前面的内容”的 Hugo 风格的 Markdown。

当我设置

additional_vim_regex_highlighting = true
时,所有内容都会按预期突出显示,但这意味着两件事正在执行相同的工作。完全删除树木保护者也可以,但其他事物的突出显示没有那么详细。

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794

:checkhealth nvim-treesitter
的输出:

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

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- WARNING `node` executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (SUSE Linux) 7.5.0
- 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 = "5.14.21-150400.24.100-default",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Mon Dec 4 19:12:13 UTC 2023 (3f5cd84)"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - dockerfile          ✓ . . . ✓
  - elixir              ✓ ✓ ✓ ✓ ✓
  - gitignore           ✓ . . . .
  - go                  ✓ ✓ ✓ ✓ ✓
  - gomod               ✓ . . . ✓
  - gosum               ✓ . . . .
  - gotmpl              ✓ . . . ✓
  - gowork              ✓ . . . ✓
  - heex                ✓ ✓ ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - json                ✓ ✓ ✓ ✓ .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - yaml                ✓ ✓ ✓ ✓ ✓

  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} ~

我不太确定问题出在哪里。是解析器吗?配色方案?如果与配色方案有关,是否有 Treesitter 支持的配色方案列表?

markdown neovim treesitter
1个回答
0
投票

解决此问题的一个粗略方法是创建一个

after/ftplugin/markdown.lua
文件。在该文件中,除此文件类型特有的其他内容外,添加

vim.cmd('TSDisable highlight')

Neovim 现在将仅对 Markdown 文件使用自己的正则表达式突出显示,这已经足够满足我的口味了。其余的文件类型将具有 Treesitter 功能。

旁注:

ftplugin
只是一个目录,不必明确安装任何具有该名称的插件。

© www.soinside.com 2019 - 2024. All rights reserved.