# Add actions to move to start and end of larger syntax node \(\#45331\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/b8fd09e7688a9790d203babfba8f6a6d6e9b6516)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: b8fd09e7688a9790d203babfba8f6a6d6e9b6516

Requested commit: b8fd09e7688a9790d203babfba8f6a6d6e9b6516

Commit: b8fd09e7688a9790d203babfba8f6a6d6e9b6516

Tree: 69be620238a92655351144061397665aebf5e1af

Author: Vamsi Raman Deeduvanu

Committer: GitHub

## Message

````
Add actions to move to start and end of larger syntax node (#45331)

Release Notes:

- Added two actions `move_to_start_of_larger_syntax_node` and
`move_to_end_of_larger_syntax_node` that move cursors to the start or
end of the parent tree-sitter node

Following up on my PR #41321, this PR only adds the actions that are
used to enable code navigation across syntax nodes, without binding them
to any keys (such as tab) by default. Both actions use the tree-sitter
syntax tree to find parent nodes of the nodes the cursors are currently
in. `move_to_start_of_larger_syntax_node` will then move each cursor to
the first position of the parent nodes while
`move_to_end_of_larger_syntax_node` to a position right after the parent
nodes.

Related issues and discussions: #22349, #14803, #42828, #13736.

This PR doesn't achieve "tab out" functionality in the exact sense as is
requested in these issues as it does not bind the actions to the tab
key. I hope this PR can start some discussion on what the best way
forward for these issues is. In the meantime, users can configure keys
to use these actions as they see fit to emulate "tab out" behavior. For
example,
```
"context": "Editor && vim_mode == insert && !in_snippet && !showing_completions",
"bindings": {
  "tab": "editor::MoveToEndOfLargerSyntaxNode",
  "shift-tab": "editor::Tab"
}
```
This will enable tab to skip past code structures like brackets when the
cursor is not in a snippet or the autocomplete menu is not open. At the
same time, shift tab will act as a backup tab.
````

## Parents

- [d92f47746f3eb83e90de8319f0e945a7b2fb8ed0](https://git.cafe/gitcafe/zed/commit/d92f47746f3eb83e90de8319f0e945a7b2fb8ed0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/b8fd09e7688a9790d203babfba8f6a6d6e9b6516?format=markdown)
