Neovim plugin that swaps closest sibling nodes (arguments, parameters, array items, etc.) using Tree-Sitter for language-aware editing.
Sibling-swap.nvim is a Neovim plugin that allows developers to quickly swap adjacent sibling nodes in code, such as function arguments, object properties, or array items. It uses Tree-Sitter for precise syntax parsing, enabling language-aware swaps without manual configuration. The plugin solves the problem of tedious manual text manipulation during refactoring or reordering code elements.
Neovim users who frequently edit code and want efficient, syntax-aware tools for refactoring, particularly developers working with multiple programming languages supported by Tree-Sitter.
Developers choose Sibling-swap.nvim for its zero-config approach that works across many languages, smart features like operand swapping in expressions, and seamless integration with Neovim's editing workflow, including dot-repeat support and sticky cursor behavior.
Neovim plugin for swaps closest siblings with Tree-Sitter
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works out-of-the-box with all Tree-Sitter supported languages without per-language setup, as highlighted in the key features and README's zero-config claim.
The cursor follows the swapped text, maintaining editing context during swaps, which is emphasized in the philosophy and features for seamless workflow integration.
Can swap operands in binary expressions and handle opposite operators, useful for refactoring mathematical code, as described in the smart swaps feature with examples.
Supports Neovim's dot-repeat and v:count for all keymaps, enabling repetitive swaps without re-triggering commands, making it efficient for bulk edits.
Allows swapping siblings across different lines via allow_interline_swaps, useful for multi-line structures like function arguments, as noted in the features.
Relies on Tree-Sitter siblings, which can lead to unintuitive swaps—such as swapping function names with parameters—as warned in the README's examples, requiring user awareness.
Configuration for injected languages like JavaScript in HTML is tricky; the ignore_injected_langs option has caveats and can break swaps if misconfigured, as detailed in the options section.
Only swaps closest siblings, making it unsuitable for reordering non-adjacent elements or performing complex multi-step refactorings without additional tools.