{"id":13822329,"url":"https://github.com/ul/kak-tree","last_synced_at":"2025-10-23T20:32:18.841Z","repository":{"id":46200017,"uuid":"163185467","full_name":"ul/kak-tree","owner":"ul","description":"Structural selections for Kakoune","archived":false,"fork":false,"pushed_at":"2022-09-07T22:56:50.000Z","size":67,"stargazers_count":100,"open_issues_count":9,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-27T10:41:17.463Z","etag":null,"topics":["kakoune","plugin","rust","tree-sitter"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ul.png","metadata":{"files":{"readme":"README.asciidoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-26T13:55:35.000Z","updated_at":"2024-09-15T04:59:44.000Z","dependencies_parsed_at":"2023-01-17T23:15:55.527Z","dependency_job_id":null,"html_url":"https://github.com/ul/kak-tree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fkak-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fkak-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fkak-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fkak-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ul","download_url":"https://codeload.github.com/ul/kak-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867845,"owners_count":16555812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kakoune","plugin","rust","tree-sitter"],"created_at":"2024-08-04T08:01:54.925Z","updated_at":"2025-10-23T20:32:18.529Z","avatar_url":"https://github.com/ul.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"= Structural selections for Kakoune\n\nkak-tree is a plugin for Kakoune which enables selection of syntax tree nodes. Parsing is performed with https://github.com/tree-sitter/tree-sitter[tree-sitter].\n\nStatus: proof of concept, interface and overall development direction could change drastically based on feedback.\n\n== Installation\n\nReplace `\"rust javascript\"` with a list of languages you need. Or use `all` to build all supported\nlanguages. Note that `all` build takes a long time, and resulting binary is quite fat which could\nhave a negative impact on responsiveness.\n\n----\ngit clone --recurse-submodules\ncargo install --path . --force --features \"rust javascript\"\ncp rc/tree.kak ~/.config/kak/autoload/\n----\n\nLook at `Cargo.toml` for a full list of supported languages.\n\nIt is possible to check programmaticaly if kak-tree was built with support for a given filetype:\n\n----\nkak-tree --do-you-understand rust\n----\n\nIf language is supported then exit code is 0 otherwise it's non-zero (1 at the moment, but it is not\nguaranteed in future).\n\n== Usage\n\nTree-sitter parsers produce very detailed syntax tree, many elements of which are not interesting\nfor day-to-day selection purposes. kak-tree introduces the concept of a _visible_ node. Node is\n_visible_ when:\n\n. Node is named in the tree-sitter grammar for the given language (as opposed to anonymous nodes,\nhttp://tree-sitter.github.io/tree-sitter/using-parsers#named-vs-anonymous-nodes[more]).\n. Either there is no white/blacklist for the given filetype or node kind is whitelisted or not\nblacklisted. See \u003c\u003cConfiguration\u003e\u003e for details about white/blacklisting.\n\nMost of the kak-tree commands operate on _visible_ nodes and skip not _visible_ ones.\n\n[cols=2*]\n|===\n\n| tree-select-parent-node [\u003cKIND\u003e]\n| Select the closest visible ancestor or ancestor of KIND when provided.\n\n| tree-select-next-node [\u003cKIND\u003e]\n| Select the closest visible next sibling or next sibling of KIND when provided.\n\n| tree-select-previous-node [\u003cKIND\u003e]\n| Select the closest visible previous sibling or previous sibling of KIND when provided.\n\n| tree-select-children [\u003cKIND\u003e]\n| Select all immediate visible children or all descendants matching KIND when provided.\n\n| tree-select-first-child [\u003cKIND\u003e]\n| Select the first immediate visible children or the first descendant matching KIND when provided.\n\n| tree-node-sexp\n| Show info box with a syntax tree of the main selection parent.\n|===\n\n== Configuration\n\nkak-tree supports configuration via a configuration file. As for now there is no default path to\nload the configuration file, and it must be given using CLI option `--config` or `-c` for short:\n\n----\nset global tree_cmd 'kak-tree -c /path/to/kak-tree.toml'\n----\n\n=== Filetype configuration\n\nConfiguration for specific filetypes should be provided like this:\n\n----\n[filetype.rust]\nblacklist = [\"identifier\", \"scoped_identifier\", \"string_literal\"]\nwhitelist = [\"function_item\"]\ngroup.identifier = [\"identifier\", \"scoped_identifier\"]\ngroup.fn = [\"function_item\"]\n\n[filetype.javascript]\ngroup.fn = [\"function\", \"arrow_function\"]\n----\n\nConfiguration under the `[filetype.default]` key will be used for all filetypes without\nconfiguration. Specific filetype configuration _doesn't_ extend default configuration but rather\noverwrites it.\n\n==== White/blacklisting\n\nIf `whitelist` array is provided then kak-tree selection will skip nodes which kinds are not whitelisted.\nIf `blacklist` array is provided then kak-tree selection will skip nodes which kinds are blacklisted.\n\nNOTE: `whitelist` takes precedence over `blacklist`. In the Rust example above kak-tree would expand\nselection up to the function definition, ignoring other node kinds.\n\nNOTE: `tree-node-sexp` command is useful for exploring node kinds which appear in the specific code.\n\nWhitelisting or blacklisting node kinds could be tedious as tree-sitter parsers define many of them,\nbut it also could be rewarding as you will be able to quickly modify selection in scopes which\nmatter for you with fewer keystrokes.\n\n==== Kind groups\n\nGroups of node kinds serve a two-fold purpose:\n\n. Groups allow matching functionally similar node kinds (i.e. `identifier` and `scoped_identifier`\nin Rust) by a single query.\n\n. Groups allow matching functionally similar nodes across filetypes (i.e. `function_item` in Rust\nand `function` in JavaScript) as tree-sitter parsers don't use uniform node kind names.\n\nNOTE: `whitelist` and `blacklist` options doesn't expand groups yet.\n\n== License\n\nFor kak-tree see UNLICENSE file. For tree-sitter and its parsers look at their repositories.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ful%2Fkak-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ful%2Fkak-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ful%2Fkak-tree/lists"}