Treesitter Selections

Selecting by shape

Treesitter understands the structure of your file, so a selection can grow along the syntax tree: from a word, to the expression, to the argument list, to the call, to the whole function.

require("nvim-treesitter.configs").setup({
  incremental_selection = {
    enable = true,
    keymaps = {
      init_selection = "<CR>",
      node_incremental = "<CR>",
      node_decremental = "<BS>",
    },
  },
})

Press <CR> to start and grow, <BS> to shrink. It beats counting vi( and va{ guesses, especially in nested code.