Commit 046f384
authored
Add textobjects.scm for Java (#111)
This adds a `textobjects.scm` file to enable Tree-sitter-based text
objects for Java. Currently, Zed only supports this functionality in Vim
mode. With this addition, you'll be able to treat several Java
constructs as text objects and target them with any Vim operator like
`d` (delete), `c` (change) or `y` (copy) or select them with `v`, as
well as navigate code semantically. Here are the details:
- Use `ic` / `ac` to work **i**nside or **a**round a `class`,
`interface`, `enum`, `record` and `annotation`
- Use `if` / `af` to work **i**nside or **a**round a `method`, `lambda`
and `constructor`
- Use `igc` / `agc` to work **i**nside or **a**round a `single-line
comment`, `multi-line comment`and `javadoc comment`
- Use `]m` / `[m` to go the next or previous `method` or `constructor`
- Use `]]` / `[[`to go the next or previous class-like construct (a
`class`, `interface`, etc.).
- Use `]/` / `[/` to go to the next or previous `comment`.
If you are interested in knowing more about these features, you can find
more information in the official Zed documentation for Tree-sitter and
for Text Objects. The Default Vim Bindings file in Zed is also a good
resource. There are good built-in text objects like `i` for indentation,
`b` for blocks or `[x` / `]x` for selecting greater or smaller syntax
nodes.1 parent 83802f4 commit 046f384
1 file changed
+65
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
0 commit comments