aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/macros.rs16
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)
+ }};
+}