nvim-lua/wishlist

Enhanced Text Objects

Open

#26 创建于 2021年7月20日

在 GitHub 查看
 (4 评论) (42 反应) (0 负责人) (0 fork)github user discovery
help wantedidea

仓库指标

Star
 (249 star)
PR 合并指标
 (PR 指标待抓取)

描述

What? An enhancement to vim/neovim's built in text objects to include seeking forward and backward over multiple lines, and selecting context specific objects like function arguments, array entries, etc, as well as generic text objects like words, inside parens, brackets...

Why? Makes working with code much more pleasant and reduces the amount of movement keys you need to press to make the changes you want to.

Potential existing implementations: This is what I have in mind, that I currently use: https://github.com/wellle/targets.vim It doesn't get updated anymore and has several outstanding bugs These also exist: https://github.com/nvim-treesitter/nvim-treesitter-textobjects https://github.com/RRethy/nvim-treesitter-textsubjects

But those last two deal with a limited set of programming language specific constructs like parameters, function bodies, etc. Those are also excellent to have, but this is more about generic text objects that are built into vim like iw, i(, i{, etc (as well as the seeking behavior that targets.vim implements). Objects like i" for example could benefit from treesitter integration, as frequently they will behave incorrectly on nested quotes, or in vimscript files where " is the comment character.

Potential pitfalls: As targets.vim shows, implementing this in a way that handles all edge cases intuitively is extremely difficult. In vimscript particularly, manipulating buffer contents with commands in plugins also can have unexpected side effects for the user. My hope would be that it's somewhat easier to achieve consistency and lack of unintended side effects with a lua plugin.

贡献者指南