summaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authorBenoît CORTIER2021-06-14 21:37:17 +0000
committerBlaž Hrastnik2021-06-20 14:25:53 +0000
commita2b8cfca34433b1d4595143652e10b58685d0dc0 (patch)
tree86c3dc49706da2755e8a4e8b0366842379392852 /helix-view/src/editor.rs
parentd59c9f3bafefaa9cf65ca711fc0e2e5cc0d250ab (diff)
Add system clipboard yank and paste commands
This commit adds six new commands to interact with system clipboard: - clipboard-yank - clipboard-yank-join - clipboard-paste-after - clipboard-paste-before - clipboard-paste-replace - show-clipboard-provider System clipboard provider is detected by checking a few environment variables and executables. Currently only built-in detection is supported. `clipboard-yank` will only yank the "main" selection, which is currently the first one. This will need to be revisited later. Closes https://github.com/helix-editor/helix/issues/76
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 35a547ad..5d18030a 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -1,3 +1,4 @@
+use crate::clipboard::{get_clipboard_provider, ClipboardProvider};
use crate::{
theme::{self, Theme},
tree::Tree,
@@ -14,9 +15,10 @@ use slotmap::SlotMap;
use anyhow::Error;
+use helix_core::Position;
+
pub use helix_core::diagnostic::Severity;
pub use helix_core::register::Registers;
-use helix_core::Position;
#[derive(Debug)]
pub struct Editor {
@@ -27,6 +29,7 @@ pub struct Editor {
pub registers: Registers,
pub theme: Theme,
pub language_servers: helix_lsp::Registry,
+ pub clipboard_provider: Box<dyn ClipboardProvider>,
pub syn_loader: Arc<syntax::Loader>,
pub theme_loader: Arc<theme::Loader>,
@@ -62,6 +65,7 @@ impl Editor {
syn_loader: config_loader,
theme_loader: themes,
registers: Registers::default(),
+ clipboard_provider: get_clipboard_provider(),
status_msg: None,
}
}