nvim-treesitter / nvim-treesitter-refactor

Refactor module for nvim-treesitter
Apache License 2.0
398 stars 25 forks source link

Allow smart_rename's grr mapping to be repeatable using '.' #29

Closed daedroza closed 2 years ago

daedroza commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I am using / to find a function and use smart_rename to modify the function name. Now I am find next usage and attempting to use '.' to rename it exactly the same as previous one. I don't intend to use sed as I don't want to perform the name change through out the file. Few instances that can be could rotated using N and n, then replaced using '.' that previous smart_rename had stored for.

Describe the solution you'd like A clear and concise description of what you want to happen. Implement '.' for repeating smart_rename.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. I couldn't think of any, hence none.

Additional context Add any other context or screenshots about the feature request here. None.

AckslD commented 2 years ago

Hi @daedroza! Did you find a solution for this? I was looking for the same and found this issue.

daedroza commented 2 years ago

I am not sure how I got it to work but you can try this https://github.com/tpope/vim-repeat

AckslD commented 2 years ago

Thanks for your reply! Maybe I'm missing something but wouldn't treesitter-refactor need to support vim-repeat natively for that to work? Ie by calling repeat#set by the end of the mapped function?

daedroza commented 2 years ago

I just use change-in-word motion and repeat it that is much easier and support larger array of functions such as deletion, etc.