nvim-treesitter / nvim-treesitter-textobjects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installing this plugin cause misbehavior on the native "f" and "t" motions.

Aex12 opened this issue · comments

Describe the bug
Just by installing this plugin (it doesnt matter if you configure it or not, it will cause the bug anyway), it will make the native vim motions for "f" and "t" misbehave, leaving you just one character before where you should be.

To Reproduce
Steps to reproduce the behavior:

  1. Install the plugin
  2. Open a new file and write 'myFunction (a: number, b: string)'
  3. Position your cursor on the first parameter 'a'.
  4. Type ct, this should remove the param completely and leave you in insert mode with a , at the right of your cursor, but instead you have 'r,' at your right.
  5. If you type cf, you should be left without any comma at your right, just an space, but instead you get the comma at your right.

Output of :checkhealth nvim-treesitter

## Installation - OK: `tree-sitter` found 0.20.7 (b268e412ad4848380166af153300464e5a1cf83f) (parser generator, only needed for :TSInstallFromGrammar) - OK: `node` found v18.13.0 (only needed for :TSInstallFromGrammar) - OK: `git` executable found. - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: cc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4) - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:

{
machine = "x86_64",
release = "6.1.8-200.fc37.x86_64",
sysname = "Linux",
version = "#1 SMP PREEMPT_DYNAMIC Tue Jan 24 20:32:16 UTC 2023"
}

Parser/Features H L F I J

- dockerfile          ✓ . . . ✓    
- gitcommit           ✓ . . . ✓    
- gitignore           ✓ . . . .    
- bash                ✓ ✓ ✓ . ✓    
- perl                ✓ . ✓ . ✓    
- python              ✓ ✓ ✓ ✓ ✓    
- yaml                ✓ ✓ ✓ ✓ ✓    
- jsdoc               ✓ . . . .    
- javascript          ✓ ✓ ✓ ✓ ✓    
- tsx                 ✓ ✓ ✓ ✓ ✓    
- css                 ✓ . ✓ ✓ ✓    
- prisma              ✓ . . . .    
- html                ✓ ✓ ✓ ✓ ✓    
- markdown_inline     ✓ . . . ✓    
- dot                 ✓ . . . ✓    
- rust                ✓ ✓ ✓ ✓ ✓    
- diff                ✓ . . . .    
- go                  ✓ ✓ ✓ ✓ ✓    
- json                ✓ ✓ ✓ ✓ .    
- lua                 ✓ ✓ ✓ ✓ ✓    
- c                   ✓ ✓ ✓ ✓ ✓    
- vim                 ✓ ✓ ✓ . ✓    
- typescript          ✓ ✓ ✓ ✓ ✓    
- regex               ✓ . . . .    
- sql                 ✓ . . . ✓    
- php                 ✓ ✓ ✓ ✓ ✓    
- markdown            ✓ . ✓ . ✓    
- help                ✓ . . . ✓    
- smali               ✓ . . . ✓    
                               
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.8.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/builddir/build/BUILD/neovim-0.8.2/redhat-linux-build/cmake.config -I/builddir/build/BUILD/neovim-0.8.2/src -I/usr/include -I/usr/include/luajit-2.1 -I/builddir/build/BUILD/neovim-0.8.2/redhat-linux-build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.8.2/redhat-linux-build/include
Compiled by mockbuild@koji

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Additional context
Add any other context about the problem here.

Can't reproduce. Can you share a minimal config that reproduces the problem?

local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system { "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "nvim-treesitter/nvim-treesitter",
  "nvim-treesitter/nvim-treesitter-textobjects",
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

From this config I don't have any problem with them.

It might be another plugin that remaps the keys when this plugin is installed. Can you check :map f and :map t if they're mapped to something?

@kiyoon Hi! Thanks for the quick reply.

I just changed from packer.nvim to lazy.nvim and the problem seems to be solved. Not sure why it didn't work as expected with packer.

Okey, after a bit of playing, seems like the issue is caused when using the 'nvim-treesitter.textobjects.repeatable_move' extension with the builtIn 'f', 'F', 't', 'T' binded to their respective mappings

You're right, thanks for reporting the issue. I'll work on this soon