Change groups slightly

This commit is contained in:
xenia 2023-11-12 23:29:11 +01:00
parent 32a77b3a31
commit 2c17cea19e
2 changed files with 23 additions and 15 deletions

View File

@ -1,34 +1,41 @@
# tree-sitter
tree-always-highlight
set-option global tree_highlight_style ",rgb:404040"
declare-user-mode tree
map global normal 't' ":enter-user-mode tree<ret>"
map global normal '<tab>' ":enter-user-mode tree<ret>"
map global normal 'T' ":enter-user-mode -lock tree<ret>"
map -docstring "select node" global tree 'n' ":tree-select-node<ret>"
map -docstring "select parent" global tree 'k' ":tree-select-parent-node<ret>"
# map -docstring "select children" global tree 'c' ":tree-select-children<ret>"
map -docstring "select children" global tree 'C' ":tree-select-children<ret>"
map -docstring "select node" global tree 'n' ":tree-select-node<ret>"
map -docstring "select parent" global tree 'k' ":tree-select-parent-node<ret>"
map -docstring "select children" global tree 'C' ":tree-select-children<ret>"
map -docstring "select children of type" global tree 'c' ":enter-user-mode tree-children<ret>"
map -docstring "select next node of type" global tree 'l' ":enter-user-mode tree-next<ret>"
map -docstring "select previous node of type" global tree 'h' ":enter-user-mode tree-prev<ret>"
map -docstring "show sexp" global tree 's' ":tree-node-sexp<ret>"
map -docstring "enable highlighting" global tree '"' ":tree-always-highlight<ret>"
map -docstring "disable highlighting" global tree '&' ":tree-always-highlight-disable<ret>"
map -docstring "select next node of type" global tree 'l' ":enter-user-mode tree-next<ret>"
map -docstring "select previous node of type" global tree 'h' ":enter-user-mode tree-prev<ret>"
map -docstring "show sexp" global tree 's' ":tree-node-sexp<ret>"
map -docstring "enable highlighting" global tree '"' ":tree-always-highlight<ret>"
map -docstring "disable highlighting" global tree '&' ":tree-always-highlight-disable<ret>"
declare-user-mode tree-children
declare-user-mode tree-next
declare-user-mode tree-prev
map global normal 'f' ":enter-user-mode tree-next<ret>"
map global normal 'F' ":enter-user-mode tree-children<ret>"
evaluate-commands %sh{
echo "i,identifier
f,function
d,declaration
t,type
c,call
a,arguments
s,statement" |
s,statement
d,declaration
n,number
\",string" |
while IFS=, read -r cmd group ; do
echo "map -docstring '$group child' global tree-children '$cmd' ':tree-select-children $group<ret>'"
echo "map -docstring 'next $group' global tree-next '$cmd' ':tree-select-next-node $group<ret>'"
echo "map -docstring 'previous $group' global tree-prev '$cmd' ':tree-select-previous-node $group<ret>'"
done
}

View File

@ -1,8 +1,9 @@
[filetype.rust]
group.identifier = ["identifier", "scoped_identifier"]
group.function = ["function_item"]
group.declaration = ["function_item", "struct_item", "enum_item"]
group.declaration = ["const_item", "macro_invocation", "macro_definition", "empty_statement", "attribute_item", "inner_attribute_item", "mod_item", "foreign_mod_item", "struct_item", "union_item", "enum_item", "type_item", "function_item", "function_signature_item", "impl_item", "trait_item", "associated_type", "let_declaration", "use_declaration", "extern_crate_declaration", "static_item"]
group.call = ["macro_invocation", "call_expression"]
group.arguments = ["arguments", "token_tree"]
group.statement = ["expression_statement", "let_declaration"]
group.string = ["string_literal", "raw_string_literal"]
group.number = ["integer_literal", "float_literal", "negative_literal"]
group.type = ["abstract_type", "reference_type", "metavariable", "pointer_type", "generic_type", "scoped_type_identifier", "tuple_type", "unit_type", "array_type", "function_type", "macro_invocation", "empty_type", "dynamic_type", "bounded_type", "primitive_type"]