Skip to content

A neovim plugin for fast navigation around the abstract syntax tree

License

Notifications You must be signed in to change notification settings

ccjmne/treewalker.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build status Static Badge Neovim

Treewalker.nvim

A demo of moving around some code quickly using the plugin

Treewalker is a plugin that gives you the ability to move around your code in a syntax tree aware manner. It uses Treesitter under the hood for syntax tree awareness. It offers four subcommands: Up, Down, Right, and Left. Each command moves through the syntax tree in an intuitive way.

  • Up/Down - Moves up or down to the next neighbor node
  • Right - Finds the next good child node
  • Left - Finds the next good parent node

Moving slowly, showing each command A demo of moving around some code slowly typing out each command


Installation

Lazy:
{
  "aaronik/treewalker.nvim",
  opts = {
    highlight = true -- Whether to briefly highlight the node after jumping to it
                     -- Can be numeric to specify highlight duration instead
  }
}

Mapping

This is how I have mine mapped; in init.lua:

vim.api.nvim_set_keymap('n', '<C-j>', ':Treewalker Down<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-k>', ':Treewalker Up<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-h>', ':Treewalker Left<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-l>', ':Treewalker Right<CR>', { noremap = true })

About

A neovim plugin for fast navigation around the abstract syntax tree

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 99.1%
  • Makefile 0.9%