Skip to content

Modifying selections with path patterns #4

@Screwtapello

Description

@Screwtapello

Raw Kakoune has commands to add and move selections through the file's linear structure, like h and C and ]p.

kak-tree has commands to add and move selections through the file's hierarchical structure, like tree-select-node and tree-select-prev-node and tree-select-children.

Raw Kakoune also has commands to sub-select and filter selections based on the file's linear structure, like s and k.

kak-tree should have commands to sub-select and filter selections based on the file's hierarchical structure:

  • tree-select-nodes KIND selects all the KIND nodes wholly contained within an existing selection
  • tree-split-nodes KIND slices the KIND nodes out of existing selections
    • not so useful in a hierarchical context, but for completeness and by analogy with Kakoune's core operators
  • tree-keep-matching KIND discards selections that do not wholly contain at least one KIND node
  • tree-kill-matching KIND discards selections that do wholly contain at least one KIND node

Ideally, these commands should use -shell-script-candidates to let Kakoune auto-complete the possible kinds for the current file.

There's possible extension here for kind-paths, like arguments/string_literal to only select string_literals directly inside an arguments or /arguments//string_literal to select string_literals anywhere inside whichever selections exactly cover an arguments, but that's all polish and future extension work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions