nvim-treesitter / nvim-treesitter-textobjects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

visual selections insert newlines rather than selecting

iHnR opened this issue · comments

commented

I have set up with the config found in the help page.

The builtin functions work well with y,d,c, but not with v or V. Typing vif,vaf,vic,vac, etc inserts newlines rather than selecting the block.

Because desctiptions are hard, I made a video. This shows a python function. I have confirmed the same behaviour on python classes and rust functions.

Screencast.from.13-02-23.00.41.39.webm

Are you sure you're using the latest nvim-treesitter?

I also encountered this problem. I use lunarvim

I also had this exact same issue, but following @kiyoon's comment I updated nvim-treesitter. Now, visual selections work as expected!

I use vim-plug, so for me I just had to run :PlugUpdate and now it all works fine!

commented

Are you sure you're using the latest nvim-treesitter?

I just updated using PackerUpdate but the problem persists.

As @leateng mentioned it, I'm also using Lunarvim, so that might be related.

@iHnR Not sure about packer, but maybe you need to :PackerCompile?

Just make sure that the nvim-treesitter version is correctly up-to-date. Check the commit hash if it matches the newest version.

Seems to be a duplicate of #358 and it seems to be caused by the wrong usage of packer.nvim.

You need to run :PackerUpdate and :PackerCompile to update the plugins.
Or just run :PackerSync which includes both of the commands.
See packer.nvim.

It may be a good idea to add the autocmd to run :PackerCompile automatically just like in the readme.

commented

@kiyoon Still persisting unfortunately :/

If I find the time, I'll check if it persists with a "clean" nvim install.

@iHnR Maybe LunarVim adds checkpoint to nvim-treesitter to make it stable. So you need to manually check the version if it's updated or not. I think that will fix it.

commented

@kiyoon That was my guess. I'll snoop around and inform if I find something.

https://github.com/LunarVim/LunarVim/blob/fde46c4b163dfeb51407efdc2929cfc723fd15c6/snapshots/default.json#L89-L91

Notice how LunarVim keeps snapshot of some plugins. If you want to keep the old version, you also need to use the old version of nvim-treesitter-textobjects

commented

@kiyoon Thanks for your assistance. It works after changing the snapshot to the latest commit, then running PackerSync followed by TSUpdateSync.

I'm having a similar issue, even after updating the snapshot in lunarvim.

commented

I'm having a similar issue, even after updating the snapshot in lunarvim.

I ended up removing the whole block for nvim-treesitter from the snapshots file. I did have some trouble getting it to persist but it has been working fine for a while. Can't really tell you what the key solution was because I'm not really sure :p