Something I really miss when working with non-Lisp languages is the ability to easily manipulate portions of code programatically.
Vim has, historically, provided text objects as a way to address that need. They're quite useful, but lack awareness of language-specific constructs—those would require a languag-aware parser.
I have recently learned that nvim-treesitter, being particularly well positioned to solve that problem (since it keeps the AST representation), provides some of that functionality natively:
require'nvim-treesitter.configs'.setup {
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn", -- set to `false` to disable one of the mappings
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
}
The default mappings might be a bit awkward. A user on reddit has suggested a different set of mappings that might be more convenient.
This setup has been making my life much easier when editing deeply nested TypeScript expressions.