vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

Tree-sitter quotes tracking

Open andymass opened this issue 2 years ago • 8 comments

To enable, add enable_quotes = true in lua config.

  • [ ] astro
  • [ ] bash
  • [x] c
  • [x] cpp
  • [ ] elm
  • [x] go
  • [x] html
  • [x] javascript
  • [x] jsx
  • [ ] julia
  • [x] lua
  • [x] perl
  • [x] python
  • [ ] ruby
  • [x] rust
  • [x] svelte
  • [x] tsx
  • [x] typescript
  • [ ] vim
  • [x] vue

andymass avatar May 07 '23 01:05 andymass

Where are we supossed to enable this exactly?

Zeioth avatar May 29 '23 17:05 Zeioth

Put enable_quotes in the tree sitter config under matchup and make sure you have the latest HEAD

On Mon, May 29, 2023, 1:19 PM Zeioth @.***> wrote:

Where are we suppossed to enable this exactly? I've tried this on lazy.

-- vim-matchup [improved % motion] -- https://github.com/andymass/vim-matchup { "andymass/vim-matchup", lazy = false, config = function() enable_quotes = true end, },

And also on treesitter

"nvim-treesitter/nvim-treesitter",
dependencies = {
  "windwp/nvim-ts-autotag",
  "JoosepAlviste/nvim-ts-context-commentstring",
},
event = "User BaseFile",
cmd = {
  "TSBufDisable",
  "TSBufEnable",
  "TSBufToggle",
  "TSDisable",
  "TSEnable",
  "TSToggle",
  "TSInstall",
  "TSInstallInfo",
  "TSInstallSync",
  "TSModuleInfo",
  "TSUninstall",
  "TSUpdate",
  "TSUpdateSync",
},
build = ":TSUpdate",
opts = {
  highlight = {
    enable = true,
    disable = function(_, bufnr)
      return vim.api.nvim_buf_line_count(bufnr) > 10000
    end,
  },
  matchup = {
    -- enables vim-matchup integration
    enable = true, -- mandatory, false will disable the whole extension
    enable_quotes = true,
  },
  incremental_selection = { enable = true },
  indent = { enable = true },
  autotag = { enable = true },
  context_commentstring = { enable = true, enable_autocmd = false },
},
config = function(_, opts) require("nvim-treesitter.configs").setup(opts) end,

},

But doesn't seem to match quotes. Testing on lua.

— Reply to this email directly, view it on GitHub https://github.com/andymass/vim-matchup/issues/287#issuecomment-1567364569, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSY3DK3YAWQYNXNGLR63CDXITLAVANCNFSM6AAAAAAXYQBAJI . You are receiving this because you authored the thread.Message ID: @.***>

andymass avatar May 29 '23 17:05 andymass

lazy.nvim package manager

  --  vim-matchup [improved % motion]
  --  https://github.com/andymass/vim-matchup
  {
    "andymass/vim-matchup",
    lazy = false,
  },

treesitter

  matchup = {
    -- enables vim-matchup integration
    enable = true,
    enable_quotes = true,
  },
  auto_install = true, -- Install a parser for the current language if not present.

EDIT: This is the solution that worked for me. I leave it here as reference.

Zeioth avatar May 29 '23 18:05 Zeioth

Maybe you need a TSInstall or TSUpdate

On Mon, May 29, 2023, 2:01 PM Zeioth @.***> wrote:

I seem to be in HEAD [image: screenshot_2023-05-29_19-58-59_910193273] https://user-images.githubusercontent.com/3357792/241785569-9811bee0-f66b-42af-a216-f46bd7a755b4.png

I've tried with

lazy

-- vim-matchup [improved % motion] -- https://github.com/andymass/vim-matchup { "andymass/vim-matchup", lazy = false, },

treesitter

  matchup = {
    -- enables vim-matchup integration
    enable = true,
    enable_quotes = true,
    -- disable = {},  -- optional, disable by language
  },

Still not working

— Reply to this email directly, view it on GitHub https://github.com/andymass/vim-matchup/issues/287#issuecomment-1567391554, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSY3DJNI72DFX4G3X5A2UTXITQBDANCNFSM6AAAAAAXYQBAJI . You are receiving this because you authored the thread.Message ID: @.***>

andymass avatar May 29 '23 18:05 andymass

Can you please share the whole config? I can't imagine what's wrong as it all seems good.

On Mon, May 29, 2023, 4:02 PM Zeioth @.***> wrote:

Still not working after

:TSInstall lua

— Reply to this email directly, view it on GitHub https://github.com/andymass/vim-matchup/issues/287#issuecomment-1567472761, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSY3DO6UVBBFCV3SYYYD4DXIT6HFANCNFSM6AAAAAAXYQBAJI . You are receiving this because you authored the thread.Message ID: @.***>

andymass avatar May 29 '23 20:05 andymass

Yes it's online here. Sorry for the inconvenience.

UPDATE: Seems to be fixed now. I confirm one needs to run this to be able to use it.

:TSInstall lua

Thank you so much for your help @andymass

EDIT → :TSInstall is not necessary if you use the option auto_install = true in treesitter. See example above.

Zeioth avatar May 29 '23 20:05 Zeioth

Just wanted to say thank you for this feature! Prior to this, I didn't really see the point of using this plugin, since the vanilla % was enough for me, but with matching quotes this plugin is gold and almost a must-have already ❤️

chrisgrieser avatar May 30 '23 17:05 chrisgrieser