diff options
author | Blaž Hrastnik | 2021-10-10 13:11:01 +0000 |
---|---|---|
committer | GitHub | 2021-10-10 13:11:01 +0000 |
commit | f8f63c55081ee966c7cb2b84139c25c6301b5fff (patch) | |
tree | c4c74c5c013d8c26f6b9b124821fabd9200c3218 /helix-view/src/macros.rs | |
parent | a7f49fa56fecd7f44efca7e6074e5cd9e5d91c92 (diff) | |
parent | 76b1bbc23ad5fc47765472cd9e83727a43c97ff3 (diff) |
Merge pull request #821 from helix-editor/idle-timer
Idle timer / Autocompletion
Diffstat (limited to 'helix-view/src/macros.rs')
-rw-r--r-- | helix-view/src/macros.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/helix-view/src/macros.rs b/helix-view/src/macros.rs index c9a04270..0bebd02f 100644 --- a/helix-view/src/macros.rs +++ b/helix-view/src/macros.rs @@ -44,3 +44,19 @@ macro_rules! view { $( $editor ).+ .tree.get($( $editor ).+ .tree.focus) }}; } + +#[macro_export] +macro_rules! doc { + ( $( $editor:ident ).+ ) => {{ + $crate::current_ref!( $( $editor ).+ ).1 + }}; +} + +#[macro_export] +macro_rules! current_ref { + ( $( $editor:ident ).+ ) => {{ + let view = $( $editor ).+ .tree.get($( $editor ).+ .tree.focus); + let doc = &$( $editor ).+ .documents[view.doc]; + (view, doc) + }}; +} |