nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Disabling of highlighting on a particular language prevents text highlights from working
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Describe the bug
When I disable highlighting in treesitter for a particular language, none of my text movements work.
To Reproduce
Here is my config in lazy nvim:
return { ╭──────────────────────────────────────────────────╮
{ -- Highlight, edit, and navigate code │ lazy.nvim 11:40:17 │
"nvim-treesitter/nvim-treesitter", │━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━│
build = function() │# Config Change Detected. Reloading... │
pcall(require("nvim-treesitter.install").update { with_sync = true }) │ │
end, │- changed: lua/plugins/nvim_treesitter.lua │
dependencies = "nvim-treesitter/nvim-treesitter-textobjects", ╰──────────────────────────────────────────────────╯
config = function()
require("nvim-treesitter.configs").setup {
modules = {},
sync_install = false,
auto_install = true,
ensure_installed = { "python", "c", "cpp", "lua", "rust", "help", "vim" },
ignore_install = { "help" },
-- indent = { enable = true },
indent = { enable = true, disable = { "python" } },
-- highlight = { enable = true },
highlight = { enable = true, disable = { "python" } },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<c-backspace>",
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
}
end,
},
}
Steps to reproduce the behavior:
Open a python file and attempt to select with vif. It wont' work.
Expected behavior
Other actions should work despite highlighting being off.
Output of :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)
- OK node found v22.13.0 (only needed for :TSInstallFromGrammar)
- OK git executable found.
- OK /mnt/disks/condaman/mamba/bin/x86_64-conda-linux-gnu-cc executable found. Selected from { "/mnt/disks/condaman/mamba/bin/x86_64-conda-linux-gnu-cc", "cc", "gcc", "clang", "cl", "zig" }
Version: x86_64-conda-linux-gnu-cc (conda-forge gcc 14.2.0-2) 14.2.0
- OK Neovim was compiled with tree-sitter runtime ABI version 15 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "6.1.0-32-cloud-amd64",
sysname = "Linux",
version = "#1 SMP PREEMPT_DYNAMIC Debian 6.1.129-1 (2025-03-06)"
}
Parser/Features H L F I J
- c ✓ ✓ ✓ ✓ ✓
- cpp ✓ ✓ ✓ ✓ ✓
- go ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- rust ✓ ✓ ✓ ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
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}
Output of nvim --version
NVIM v0.11.0
Build type: Release
LuaJIT 2.1.1741730670
Run "nvim -V1 -v" for more info
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce with the shown lazy.nvim configuration by opening a Python file and trying vif, then inspect the nvim-treesitter.configs.setup handling for highlight.disable alongside the textobjects configuration. Done means textobject selection and movement continue to work when Python highlighting is disabled; verify the behavior with the reported Neovim and nvim-treesitter versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100