Skip to content

🌲 A Neovim plugin for jumping between significant code elements, such as brackets, quotes, etc.

Notifications You must be signed in to change notification settings

roobert/tabtree.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

🌲 TabTree

TabTree Demo

Overview

TabTree is a Neovim plugin designed to enhance navigation within code by leveraging the power of Tree-sitter. It allows users to jump between significant code elements, such as brackets, quotes, etc.

Additional language configs welcome as PRs!

Usage

Keys

Default key bindings for Normal mode, these should not interfere with nvim-cmp Insert mode bindings:

Key Action
<Tab> require('tabtree').next()
<S-Tab> require('tabtree').previous()

Installation

LazyVim example:

  {
    "roobert/tabtree.nvim",
    config = function()
      require("tabtree").setup()
    end,
  },

Configuration

Override any configuration option by passing an options table to the setup function:

  {
    "roobert/tabtree.nvim",
    config = function()
      require("tabtree").setup({
        -- print the capture group name when executing next/previous
        --debug = true,

        -- disable key bindings
        --key_bindings_disabled = true,

        key_bindings = {
          next = "<Tab>",
          previous = "<S-Tab>",
        },

        -- use :InspectTree to discover the (capture group)
        -- @capture_name can be anything
        language_configs = {
          python = {
            target_query = [[
              (string) @string_capture
              (interpolation) @interpolation_capture
              (parameters) @parameters_capture
              (argument_list) @argument_list_capture
            ]],
            -- experimental feature, to move the cursor in certain situations like when handling python f-strings
            offsets = {
              string_start_capture = 1,
            },
          },
        },

        default_config = {
          target_query = [[
              (string) @string_capture
              (interpolation) @interpolation_capture
              (parameters) @parameters_capture
              (argument_list) @argument_list_capture
          ]],
          offsets = {},
        }
      })
    end,
  },

References

Inspired by abecodes/tabout.nvim.

About

🌲 A Neovim plugin for jumping between significant code elements, such as brackets, quotes, etc.

Resources

Stars

Watchers

Forks

Languages