# Gap cursor

> Place the caret between closed blocks in a GPUI editor.

## Try it

Click halfway between the two horizontal rules. A short blue line marks the gap. Press **Right Arrow** to select the second rule.

[Gap cursor example](https://gpdoc.dev/docs/plugins/behavior/gap-cursor/#gap-cursor-example)

## Install

```sh
cargo add gpdoc-plugin-gap-cursor
```

## Example

```rust
use gpdoc_plugin_gap_cursor::{gap_cursor, paint_gap_cursor};
use gpdoc_plugin_paragraph::paragraph;


let config = gpdoc::EditorConfig::builder()
    .plugin(paragraph())
    .plugin(gap_cursor().with_view(paint_gap_cursor))
    .build()
    .expect("configure editor");
```

To draw a different marker, pass a painter to `.with_view(...)` taking `Bounds<Pixels>`, `&mut Window`, and `&mut App`. The plugin locates the boundary and handles keyboard and pointer navigation.

Open a document with two adjacent closed blocks, such as [horizontal rules](/docs/plugins/structure/horizontal-rule/). Click their shared boundary to select the gap. In a focused editor, a short horizontal line marks the insertion point.

From a selected node, the arrow keys move to an adjacent gap. From a gap, they select the neighboring node in that direction.

## Source code

[gap-cursor/src/lib.rs](/source/plugins/gap-cursor/src/lib.rs.txt)