Skip to content

Region selection with hints on the AST nodes of a document powered by treesitter

License

Notifications You must be signed in to change notification settings

davidatsurge/nvim-treehopper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TSHT (Treesitter hint textobject)

Plugin that provides region selection using hints on the abstract syntax tree of a document. This is intended to be used for pending operator mappings.

Demo

Requirements

  • Requires Neovim HEAD/Nightly
  • A treesitter parser for each language you plan to use the plugin with.
    • Parsers can be installed via nvim-treesitter TSInstall
    • For manual installation, you need to compile the language specific parsers using gcc and place the object files into ~/.config/nvim/parser.
  • locals queries for each language you plan to use the plugin with.
    • nvim-treesitter ships locals queries for many languages. If you've it installed they'll be picked up.
    • You can install them manually by placing locals.scm query files into ~/.config/nvim/queries/<language>/

Installation

  • nvim-ts-hint-textobject is a plugin. Install it like any other neovim plugin:
    • If using vim-plug: Plug mfussenegger/nvim-ts-hint-textobject
    • If using packer.nvim: use mfussenegger/nvim-ts-hint-textobject

Usage

Define two mapppings:

omap     <silent> m :<C-U>lua require('tsht').nodes()<CR>
vnoremap <silent> m :lua require('tsht').nodes()<CR>

You can configure which keys are used for hint labels, the first N characters will be taken from the hint_keys and then after that it will restart from a-zA-Z

require("tsht").config.hint_keys = { "h", "j", "f", "d", "n", "v", "s", "l", "a" }

Credits

About

Region selection with hints on the AST nodes of a document powered by treesitter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 92.2%
  • Vim Script 7.8%