Skip to content

typescriptreact filetype doesn't support move keymaps #792

@nickbreid

Description

@nickbreid

Describe the bug
Move keymaps that work in Lua and Python and Typescript do not work when the filetype is typescriptreact. In the same typescriptreact file, after running :set filetype=typescript, the mappings work as expected.

To Reproduce

Using a config like the below:

require "nvim-treesitter.configs".setup({
    ensure_installed = { "typescript", "javascript", "python", "lua" },
    highlight = { enable = true },
    indent = { enable = true },
    autopairs = { enable = true },
    textobjects = {
        select = {
            enable = true,
            keymaps = {
                ["if"] = "@function.inner",
                ["af"] = "@function.outer",
                ["ic"] = "@class.inner",
                ["ac"] = "@class.outer",
                ["ia"] = "@parameter.inner",
                ["aa"] = "@parameter.outer",
            },
        },
        move = {
            enable = true,
            goto_next_start = {
                ["]f"] = "@function.outer",
                ["]c"] = "@class.outer",
            },
            goto_previous_start = {
                ["[f"] = "@function.outer",
                ["[c"] = "@class.outer",
            },
        },
    },
})
  1. Open a typescriptreact file
  2. Observe that ts_ls is attached
  3. Press [f to jump to a function
  4. Observe that nvim executes the default behavior of [f which is synonymous with gf
  5. Run :set filetype=typescriptreact
  6. Press [f
  7. Observe that the behavior works as expected

Expected behavior
I expect that [f should jump to a function when the filetype is typescriptreact instead of execute gf

Output of :checkhealth nvim-treesitter

==============================================================================
2 nvim-treesitter: 1 ⚠️
3
4 Installation
5 - ⚠️ WARNING tree-sitter executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
6 - ✅ OK node found v22.17.1 (only needed for :TSInstallFromGrammar)
7 - ✅ OK git executable found.
8 - ✅ OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
9 Version: Apple clang version 16.0.0 (clang-1600.0.26.6)
10 - ✅ OK Neovim was compiled with tree-sitter runtime ABI version 15 (required >=13). Parsers must be compatible with runtime ABI.
11
12 OS Info:
13 {
14 machine = "arm64",
15 release = "24.4.0",
16 sysname = "Darwin",
17 version = "Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041"
18 }
19
20 Parser/Features H L F I J
21 - c ✓ ✓ ✓ ✓ ✓
22 - javascript ✓ ✓ ✓ ✓ ✓
23 - lua ✓ ✓ ✓ ✓ ✓
24 - markdown ✓ . ✓ ✓ ✓
25 - markdown_inline ✓ . . . ✓
26 - python ✓ ✓ ✓ ✓ ✓
27 - query ✓ ✓ ✓ ✓ ✓
28 - svelte ✓ ✓ ✓ ✓ ✓
29 - typescript ✓ ✓ ✓ ✓ ✓
30 - vim ✓ ✓ ✓ . ✓
31 - vimdoc ✓ . . . ✓
32
33 Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
34 +) multiple parsers found, only one will be used
35 x) errors found in the query, try to run :TSUpdate {lang}
36

Output of nvim --version

NVIM v0.12.0-dev-916+g68eece8b84

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions