Neovim plugin providing location and syntax aware text objects that intelligently select code based on context.
nvim-treesitter-textsubjects is a Neovim plugin that provides intelligent text objects using Tree-sitter's syntax parsing. It allows users to select code blocks (like functions, classes, or loops) based on their cursor location and the surrounding syntax tree, making code manipulation faster and more intuitive.
Neovim users who frequently edit code and want more efficient text object selections without memorizing numerous mappings. It's particularly useful for developers working in multiple programming languages.
Unlike traditional text object plugins, it uses heuristics to select the most relevant syntactical unit automatically, reducing cognitive load and providing a "do what you mean" experience. It complements existing plugins like nvim-treesitter-textobjects by offering smarter, context-aware selections.
Location and syntax aware text objects which do what you mean
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses context-aware heuristics to intelligently handle whitespace and select the most relevant syntactical unit, making editing intuitive as described in the philosophy section.
Works with multiple languages like C, Python, Rust, and more, offering consistent text object behavior across them, as shown in the compatibility table.
Requires no configuration out of the box with pre-defined keymaps like ';' and '.', enabling immediate use as per the Quick Start guide.
Allows users to define custom text subjects using Tree-sitter query files, enabling tailored selections for specific syntax patterns, as demonstrated in the Custom Query section.
Some languages, such as Elixir and JavaScript/JSX, lack support for container-inner text objects, limiting functionality as indicated by white squares in the feature table.
Requires nvim-treesitter to be installed and configured, adding an extra layer of setup and potential points of failure, which is noted as a prerequisite.
The author admits that names like 'textsubjects-smart' are confusing, and advanced customization relies on Tree-sitter query knowledge, which can be a barrier for some users.