diff options
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/application.rs | 3 | ||||
-rw-r--r-- | helix-term/src/commands.rs | 9 | ||||
-rw-r--r-- | helix-term/src/ui/mod.rs | 5 |
3 files changed, 12 insertions, 5 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 38c0d88a..dcc6433b 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -39,7 +39,8 @@ impl Application { let files = args.values_of_t::<PathBuf>("files").unwrap(); for file in files { - editor.open(file)?; + use helix_view::editor::Action; + editor.open(file, Action::HorizontalSplit)?; } compositor.push(Box::new(ui::EditorView::new())); 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<lsp::Location>) { + 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<lsp::Location>) { 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]; diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index f91a9f35..a625aa14 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -101,7 +101,10 @@ pub fn file_picker(root: &str) -> Picker<PathBuf> { path.strip_prefix("./").unwrap().to_str().unwrap().into() }, move |editor: &mut Editor, path: &PathBuf| { - let document_id = editor.open(path.into()).expect("editor.open failed"); + use helix_view::editor::Action; + let document_id = editor + .open(path.into(), Action::Replace) + .expect("editor.open failed"); }, ) } |