aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-24 05:28:26 +0000
committerBlaž Hrastnik2021-03-24 05:28:26 +0000
commit8a0ab447ecfa6c2c448603d469ba4fd06e95c754 (patch)
tree9bf78106dbc54d02f7938d287467da44feaffe9d /helix-term/src/commands.rs
parentb24cdd1295d1129dc730e02da2c6723938220d7e (diff)
editor.open can now either replace the current view or open in a split.
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs9
1 files changed, 6 insertions, 3 deletions
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];