From 8a0ab447ecfa6c2c448603d469ba4fd06e95c754 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 24 Mar 2021 14:28:26 +0900 Subject: editor.open can now either replace the current view or open in a split. --- helix-term/src/commands.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'helix-term/src/commands.rs') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 9544b0e0..12d80a0f 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -798,7 +798,8 @@ pub fn command_mode(cx: &mut Context) { // editor.should_close = true, } ["o", path] | ["open", path] => { - editor.open(path.into()); + use helix_view::editor::Action; + editor.open(path.into(), Action::Replace); } ["w"] | ["write"] => { // TODO: non-blocking via save() command @@ -992,11 +993,13 @@ pub fn exit_select_mode(cx: &mut Context) { } fn goto(cx: &mut Context, locations: Vec) { + use helix_view::editor::Action; cx.doc().mode = Mode::Normal; match locations.as_slice() { [location] => { - cx.editor.open(PathBuf::from(location.uri.path())); + cx.editor + .open(PathBuf::from(location.uri.path()), Action::Replace); let doc = cx.doc(); let definition_pos = location.range.start; let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text(), definition_pos); @@ -1012,7 +1015,7 @@ fn goto(cx: &mut Context, locations: Vec) { format!("{}:{}", file, line).into() }, move |editor: &mut Editor, item| { - editor.open(PathBuf::from(item.uri.path())); + editor.open(PathBuf::from(item.uri.path()), Action::Replace); // TODO: issues with doc already being broo let id = editor.view().doc; let doc = &mut editor.documents[id]; -- cgit v1.2.3-70-g09d2