Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve Usage section of README.md #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ Use your preferred plugin manager - no extra steps needed.

## Usage

Just define one mapping, and you're good to go:
This plugin allows you to instantly select or jump to the beginning of an AST node. Add something like this to your `init.lua`.

```lua
vim.keymap.set({'n', 'x', 'o'}, '<some-key>', function() require'leap-ast'.leap() end, {})
vim.keymap.set({'n', 'x', 'o'}, '<space>t', function() require'leap-ast'.leap() end, {})
```

Then, when you're editing a file with a Tree-sitter parser enabled, type `<space>t`. Labels for each AST node that containing the cursor will appear. In normal mode, entering a label will take you to the beginning of the corresponding node. In visual and operator-pending mode, entering a label will select the corresponding node. This is useful for selecting quickly pieces of code based on syntax, which is usually what you want.