ghostbuster91 / nvim-next

Apache License 2.0
29 stars 6 forks source link

Treesitter-textobjects example from front page doesn't work #5

Closed Hubro closed 1 year ago

Hubro commented 1 year ago

I implemented the gitsigns example, which worked, but the treesitter-textobjects one doesn't. Here's my relevant config:

require("nvim-next.integrations").treesitter_textobjects()

require("nvim-treesitter.configs").setup({

  -- ...

  textobjects = {
    select = {
      enable = true,
      lookahead = true,
      include_surrounding_whitespace = false,

      keymaps = {
        ["af"] = "@function.outer",
        ["if"] = "@function.inner",
        ["ac"] = "@comment.outer",
        ["ic"] = "@comment.inner",
        ["ap"] = "@parameter.outer",
        ["ip"] = "@parameter.inner",
      },

      selection_modes = {},
    },

    swap = {
      enable = true,
      swap_next = {
        ["<leader>+"] = "@parameter.inner",
      },
      swap_previous = {
        ["<leader>-"] = "@parameter.inner",
      },
    },
  },

  nvim_next = {
    textobjects = {
      enable = true,

      move = {
        -- enable = true,
        -- set_jumps = true,
        goto_next_start = {
          ["]f"] = "@function.outer",
        },
        goto_previous_start = {
          ["[f"] = "@function.outer",
        },
      },
    },
  },
})

This simply does nothing right now. No errors, but nothing gets bound to ]f or [f either.

ghostbuster91 commented 1 year ago

Indeed the enable was incorrectly nested. I pushed a fix, could you try again?

Hubro commented 1 year ago

That did it! I almost immediately discovered another bug though, but I'll make a new issue for that :sweat_smile: