ul / kak-tree

Structural selections for Kakoune
The Unlicense
100 stars 10 forks source link

README : be more explicit about <KIND> and add small example #21

Open sucrecacao opened 4 years ago

sucrecacao commented 4 years ago

Hi, I have been advised to use kak-tree for a plugin I'm working on. But I have trouble getting started with it. What are the value I can use in the variable ? Could it be possible to have a tiny example of a basic workflow ? For example how to use kak-tree in a plugin script ?

ul commented 4 years ago

KIND is a placeholder for a node kind. Unfortunately, each parser defines its own set of kinds (that's why I added support for groups into kak-tree so users can unify those kinds).

Imagine your plugin wants to select up to a function scope and you know that parser for this language defines corresponding node kind as fn or you know that user has a group fn defined in their config which abstracts parsers' kinds. Then your plugin script can evaluate command tree-select-parent-node fn to select such scope.

sucrecacao commented 4 years ago

Where can one find the list of all the KIND ?

ul commented 4 years ago

Each parser provides their own. For example, C parser has those: https://github.com/tree-sitter/tree-sitter-c/blob/master/src/node-types.json