From f3bfb8b6fdf8743d58e209fab5c05fc303aab7c1 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 15 Nov 2022 12:19:58 +0100 Subject: [PATCH 1/9] Implemented "goto-buffer" command --- helix-term/src/commands.rs | 59 +++++++++++++++++++++----------- helix-term/src/commands/typed.rs | 39 +++++++++++++++++++-- 2 files changed, 76 insertions(+), 22 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 5498a4377162..b49c513edd94 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -660,35 +660,54 @@ fn goto_line_start(cx: &mut Context) { } fn goto_next_buffer(cx: &mut Context) { - goto_buffer(cx.editor, Direction::Forward); + goto_buffer_by_direction(cx.editor, Direction::Forward) } fn goto_previous_buffer(cx: &mut Context) { - goto_buffer(cx.editor, Direction::Backward); + goto_buffer_by_direction(cx.editor, Direction::Backward) } -fn goto_buffer(editor: &mut Editor, direction: Direction) { - let current = view!(editor).doc; +/// Gets the amount of buffers that are currently open. +fn get_buffers_len(editor: &mut Editor) -> usize { + editor.documents.len() +} - let id = match direction { - Direction::Forward => { - let iter = editor.documents.keys(); - let mut iter = iter.skip_while(|id| *id != ¤t); - iter.next(); // skip current item - iter.next().or_else(|| editor.documents.keys().next()) - } - Direction::Backward => { - let iter = editor.documents.keys(); - let mut iter = iter.rev().skip_while(|id| *id != ¤t); - iter.next(); // skip current item - iter.next().or_else(|| editor.documents.keys().rev().next()) - } +fn goto_buffer_by_direction(editor: &mut Editor, dir: Direction) { + let curr_i = get_focused_buffer_idx(editor); + let buffs_len = get_buffers_len(editor); + + let new_i = match dir { + Direction::Forward if curr_i < buffs_len - 1 => curr_i + 1, + Direction::Forward => 0, // Would be out of bounds, wrap to front. + Direction::Backward if curr_i > 0 => curr_i - 1, + Direction::Backward => buffs_len - 1, // Would be out of bounds, wrap to back. + }; + + goto_buffer_by_idx_impl(editor, new_i); +} + +/// Goto a buffer by providing it's index. +/// +/// Note that the index starts from 0. +/// Out of bounds indices are ignored / a noop. +fn goto_buffer_by_idx_impl(editor: &mut Editor, i: usize) { + let all_buffs: Vec<&helix_view::DocumentId> = editor.documents.keys().collect(); + + if let Some(&&new_buff) = all_buffs.get(i) { + editor.switch(new_buff, Action::Replace); } - .unwrap(); +} - let id = *id; +fn get_focused_buffer_idx(editor: &mut Editor) -> usize { + let curr_id = view!(editor).doc; - editor.switch(id, Action::Replace); + editor + .documents + .keys() + .enumerate() + .find(|(_, d_id)| *d_id == &curr_id) + .expect("the current buffer was not in the buffers list") + .0 } fn extend_to_line_start(cx: &mut Context) { diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index c6810f05390f..f5b4fe701802 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -247,7 +247,8 @@ fn buffer_next( return Ok(()); } - goto_buffer(cx.editor, Direction::Forward); + goto_buffer_by_direction(cx.editor, Direction::Forward); + Ok(()) } @@ -260,7 +261,34 @@ fn buffer_previous( return Ok(()); } - goto_buffer(cx.editor, Direction::Backward); + goto_buffer_by_direction(cx.editor, Direction::Backward); + + Ok(()) +} + +/// Goto a buffer by providing (index) as the argument. +/// +/// Note that the index starts from 1. +fn goto_buffer_by_idx( + cx: &mut compositor::Context, + args: &[Cow], + event: PromptEvent, +) -> anyhow::Result<()> { + if event != PromptEvent::Validate { + return Ok(()); + } + + let i_str = args + .first() + .ok_or_else(|| anyhow!("requires an argument for "))? + .as_ref(); + let i = i_str + .parse::() + .map_err(|_| anyhow!("'{}' is not a valid index", i_str))?; + + // Convert to zero based index + goto_buffer_by_idx_impl(cx.editor, i - 1); + Ok(()) } @@ -1803,6 +1831,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: force_buffer_close_all, completer: None, }, + TypableCommand { + name: "buffer-goto", + aliases: &["b"], + doc: "Goto the buffer .", + fun: goto_buffer_by_idx, + completer: None, + }, TypableCommand { name: "buffer-next", aliases: &["bn", "bnext"], From c156b4275e38f0673c3b41b01eeb9383d4ce8ca8 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 15 Nov 2022 12:57:49 +0100 Subject: [PATCH 2/9] Inlined some functions Inlined some functions, that had their origin in old implementation detail, and are now unnecessary. --- helix-term/src/commands.rs | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index b49c513edd94..270ab3d15d96 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -667,14 +667,14 @@ fn goto_previous_buffer(cx: &mut Context) { goto_buffer_by_direction(cx.editor, Direction::Backward) } -/// Gets the amount of buffers that are currently open. -fn get_buffers_len(editor: &mut Editor) -> usize { - editor.documents.len() -} - fn goto_buffer_by_direction(editor: &mut Editor, dir: Direction) { - let curr_i = get_focused_buffer_idx(editor); - let buffs_len = get_buffers_len(editor); + let curr_doc = &view!(editor).doc; + let buffs_len = editor.documents.len(); + let curr_i = editor + .documents + .keys() + .position(|d| d == curr_doc) + .expect("current document was not in documents"); let new_i = match dir { Direction::Forward if curr_i < buffs_len - 1 => curr_i + 1, @@ -698,18 +698,6 @@ fn goto_buffer_by_idx_impl(editor: &mut Editor, i: usize) { } } -fn get_focused_buffer_idx(editor: &mut Editor) -> usize { - let curr_id = view!(editor).doc; - - editor - .documents - .keys() - .enumerate() - .find(|(_, d_id)| *d_id == &curr_id) - .expect("the current buffer was not in the buffers list") - .0 -} - fn extend_to_line_start(cx: &mut Context) { let (view, doc) = current!(cx.editor); goto_line_start_impl(view, doc, Movement::Extend) From 92e49e1b3dbaa1443c2fc81977a57982d71111c5 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 15 Nov 2022 22:31:01 +0100 Subject: [PATCH 3/9] Added documentation for goto-buffer command --- book/src/generated/typable-cmd.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index b7496d338c4e..8eff1c8bce06 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -9,6 +9,7 @@ | `:buffer-close-others!`, `:bco!`, `:bcloseother!` | Force close all buffers but the currently focused one. | | `:buffer-close-all`, `:bca`, `:bcloseall` | Close all buffers without quitting. | | `:buffer-close-all!`, `:bca!`, `:bcloseall!` | Force close all buffers ignoring unsaved changes without quitting. | +| `:buffer-goto`, `:b` | Goto the buffer . | | `:buffer-next`, `:bn`, `:bnext` | Goto next buffer. | | `:buffer-previous`, `:bp`, `:bprev` | Goto previous buffer. | | `:write`, `:w` | Write changes to disk. Accepts an optional path (:write some/path.txt) | From a7c5b9f51303ca7e5e81f13712a770dfd5a51b97 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 15 Nov 2022 23:55:02 +0100 Subject: [PATCH 4/9] Added shortcut for going to buffers Now able to go to specific buffers by pressing CTRL+<[1-9]>. --- helix-term/src/commands.rs | 45 ++++++++++++++++++++++++++++++++ helix-term/src/keymap/default.rs | 9 +++++++ 2 files changed, 54 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 270ab3d15d96..99d5bc37640a 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -309,6 +309,15 @@ impl MappableCommand { goto_prev_diag, "Goto previous diagnostic", goto_line_start, "Goto line start", goto_line_end, "Goto line end", + goto_first_buffer, "Goto first buffer", + goto_second_buffer, "Goto second buffer", + goto_third_buffer, "Goto third buffer", + goto_fourth_buffer, "Goto fourth buffer", + goto_fifth_buffer, "Goto fifth buffer", + goto_sixth_buffer, "Goto sixth buffer", + goto_seventh_buffer, "Goto seventh buffer", + goto_eight_buffer, "Goto eight buffer", + goto_ninth_buffer, "Goto ninth buffer", goto_next_buffer, "Goto next buffer", goto_previous_buffer, "Goto previous buffer", goto_line_end_newline, "Goto newline at line end", @@ -659,6 +668,42 @@ fn goto_line_start(cx: &mut Context) { ) } +fn goto_first_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 0); +} + +fn goto_second_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 1); +} + +fn goto_third_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 2); +} + +fn goto_fourth_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 3); +} + +fn goto_fifth_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 4); +} + +fn goto_sixth_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 5); +} + +fn goto_seventh_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 6); +} + +fn goto_eight_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 7); +} + +fn goto_ninth_buffer(cx: &mut Context) { + goto_buffer_by_idx_impl(cx.editor, 8); +} + fn goto_next_buffer(cx: &mut Context) { goto_buffer_by_direction(cx.editor, Direction::Forward) } diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index 118764d97585..c8ae047ca5b4 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -73,6 +73,15 @@ pub fn default() -> HashMap { "C" => copy_selection_on_next_line, "A-C" => copy_selection_on_prev_line, + "C-1" => goto_first_buffer, + "C-2" => goto_second_buffer, + "C-3" => goto_third_buffer, + "C-4" => goto_fourth_buffer, + "C-5" => goto_fifth_buffer, + "C-6" => goto_sixth_buffer, + "C-7" => goto_seventh_buffer, + "C-8" => goto_eight_buffer, + "C-9" => goto_ninth_buffer, "s" => select_regex, "A-s" => split_selection_on_newline, From 1357ac67d0268228007e733794a45f9567fdb9a0 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 16 Nov 2022 07:29:43 +0100 Subject: [PATCH 5/9] Removed abbreviations like "idx" and "curr" --- helix-term/src/commands.rs | 38 ++++++++++++++++---------------- helix-term/src/commands/typed.rs | 12 +++++----- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 99d5bc37640a..48bbb637a0be 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -669,39 +669,39 @@ fn goto_line_start(cx: &mut Context) { } fn goto_first_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 0); + goto_buffer_by_index_impl(cx.editor, 0); } fn goto_second_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 1); + goto_buffer_by_index_impl(cx.editor, 1); } fn goto_third_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 2); + goto_buffer_by_index_impl(cx.editor, 2); } fn goto_fourth_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 3); + goto_buffer_by_index_impl(cx.editor, 3); } fn goto_fifth_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 4); + goto_buffer_by_index_impl(cx.editor, 4); } fn goto_sixth_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 5); + goto_buffer_by_index_impl(cx.editor, 5); } fn goto_seventh_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 6); + goto_buffer_by_index_impl(cx.editor, 6); } fn goto_eight_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 7); + goto_buffer_by_index_impl(cx.editor, 7); } fn goto_ninth_buffer(cx: &mut Context) { - goto_buffer_by_idx_impl(cx.editor, 8); + goto_buffer_by_index_impl(cx.editor, 8); } fn goto_next_buffer(cx: &mut Context) { @@ -712,23 +712,23 @@ fn goto_previous_buffer(cx: &mut Context) { goto_buffer_by_direction(cx.editor, Direction::Backward) } -fn goto_buffer_by_direction(editor: &mut Editor, dir: Direction) { - let curr_doc = &view!(editor).doc; - let buffs_len = editor.documents.len(); - let curr_i = editor +fn goto_buffer_by_direction(editor: &mut Editor, direction: Direction) { + let doc_id = &view!(editor).doc; + let buffers_len = editor.documents.len(); + let current_index = editor .documents .keys() - .position(|d| d == curr_doc) + .position(|d| d == doc_id) .expect("current document was not in documents"); - let new_i = match dir { - Direction::Forward if curr_i < buffs_len - 1 => curr_i + 1, + let new_index = match direction { + Direction::Forward if current_index < buffers_len - 1 => current_index + 1, Direction::Forward => 0, // Would be out of bounds, wrap to front. - Direction::Backward if curr_i > 0 => curr_i - 1, - Direction::Backward => buffs_len - 1, // Would be out of bounds, wrap to back. + Direction::Backward if current_index > 0 => current_index - 1, + Direction::Backward => buffers_len - 1, // Would be out of bounds, wrap to back. }; - goto_buffer_by_idx_impl(editor, new_i); + goto_buffer_by_index_impl(editor, new_index); } /// Goto a buffer by providing it's index. diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index f5b4fe701802..5077933eaa95 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -269,7 +269,7 @@ fn buffer_previous( /// Goto a buffer by providing (index) as the argument. /// /// Note that the index starts from 1. -fn goto_buffer_by_idx( +fn goto_buffer_by_index( cx: &mut compositor::Context, args: &[Cow], event: PromptEvent, @@ -278,16 +278,16 @@ fn goto_buffer_by_idx( return Ok(()); } - let i_str = args + let index_str = args .first() .ok_or_else(|| anyhow!("requires an argument for "))? .as_ref(); - let i = i_str + let index = index_str .parse::() - .map_err(|_| anyhow!("'{}' is not a valid index", i_str))?; + .map_err(|_| anyhow!("'{}' is not a valid index", index_str))?; // Convert to zero based index - goto_buffer_by_idx_impl(cx.editor, i - 1); + goto_buffer_by_index_impl(cx.editor, index - 1); Ok(()) } @@ -1835,7 +1835,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ name: "buffer-goto", aliases: &["b"], doc: "Goto the buffer .", - fun: goto_buffer_by_idx, + fun: goto_buffer_by_index, completer: None, }, TypableCommand { From 4bf9e149bd5e8f4e8b8e14879f90ccc526a1585f Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 16 Nov 2022 07:34:12 +0100 Subject: [PATCH 6/9] Now using `Iterator::nth` Previously collected into a vector, and then indexed that. --- helix-term/src/commands.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 48bbb637a0be..c1ff714774fd 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -735,11 +735,9 @@ fn goto_buffer_by_direction(editor: &mut Editor, direction: Direction) { /// /// Note that the index starts from 0. /// Out of bounds indices are ignored / a noop. -fn goto_buffer_by_idx_impl(editor: &mut Editor, i: usize) { - let all_buffs: Vec<&helix_view::DocumentId> = editor.documents.keys().collect(); - - if let Some(&&new_buff) = all_buffs.get(i) { - editor.switch(new_buff, Action::Replace); +fn goto_buffer_by_index_impl(editor: &mut Editor, i: usize) { + if let Some(doc_id) = editor.documents.keys().nth(i).copied() { + editor.switch(doc_id, Action::Replace); } } From fa8c7aba0efa8e1b1204da667c20ac66c639f749 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 16 Nov 2022 15:31:05 +0100 Subject: [PATCH 7/9] Now completing the buffer names --- helix-term/src/commands/typed.rs | 6 +++--- helix-term/src/ui/mod.rs | 26 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 5077933eaa95..60a962735eff 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1794,14 +1794,14 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ aliases: &["bc", "bclose"], doc: "Close the current buffer.", fun: buffer_close, - completer: Some(completers::buffer), + completer: Some(completers::buffer_name), }, TypableCommand { name: "buffer-close!", aliases: &["bc!", "bclose!"], doc: "Close the current buffer forcefully, ignoring unsaved changes.", fun: force_buffer_close, - completer: Some(completers::buffer), + completer: Some(completers::buffer_name), }, TypableCommand { name: "buffer-close-others", @@ -1836,7 +1836,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ aliases: &["b"], doc: "Goto the buffer .", fun: goto_buffer_by_index, - completer: None, + completer: Some(completers::buffer_index), }, TypableCommand { name: "buffer-next", diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index cca9e9bf0b68..d6534c6068ab 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -251,7 +251,7 @@ pub mod completers { Vec::new() } - pub fn buffer(editor: &Editor, input: &str) -> Vec { + pub fn buffer_name(editor: &Editor, input: &str) -> Vec { let mut names: Vec<_> = editor .documents .iter() @@ -279,6 +279,30 @@ pub mod completers { names } + /// Completes the buffer indices. + /// + /// Note that the indices start from 1 instead of 0. + pub fn buffer_index(editor: &Editor, input: &str) -> Vec { + let indices = (0..editor.documents.len()).map(|index| Cow::from((index + 1).to_string())); + + let matcher = Matcher::default(); + + let mut matches: Vec<_> = indices + .filter_map(|index| { + matcher + .fuzzy_match(&index, input) + .map(|score| (index, score)) + }) + .collect(); + + matches.sort_unstable_by_key(|(_, score)| Reverse(*score)); + + matches + .into_iter() + .map(|(index, _)| ((0..), index)) + .collect() + } + pub fn theme(_editor: &Editor, input: &str) -> Vec { let mut names = theme::Loader::read_names(&helix_loader::runtime_dir().join("themes")); names.extend(theme::Loader::read_names( From 50747e48b036e4769b11b689d9db6f6beda1dcae Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 16 Nov 2022 15:38:05 +0100 Subject: [PATCH 8/9] Now returning err on invalid indices --- helix-term/src/commands.rs | 23 +++++++++++++++++------ helix-term/src/commands/typed.rs | 6 +++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index c1ff714774fd..2d0f4e0d6413 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -728,17 +728,28 @@ fn goto_buffer_by_direction(editor: &mut Editor, direction: Direction) { Direction::Backward => buffers_len - 1, // Would be out of bounds, wrap to back. }; - goto_buffer_by_index_impl(editor, new_index); + // Safety: The above logic ensures that the new index is always in bounds. + goto_buffer_by_index_impl(editor, new_index).unwrap(); } /// Goto a buffer by providing it's index. /// /// Note that the index starts from 0. -/// Out of bounds indices are ignored / a noop. -fn goto_buffer_by_index_impl(editor: &mut Editor, i: usize) { - if let Some(doc_id) = editor.documents.keys().nth(i).copied() { - editor.switch(doc_id, Action::Replace); - } +/// +/// # Errors +/// +/// Returns an error if the index could not be found - is out of bounds. +fn goto_buffer_by_index_impl(editor: &mut Editor, index: usize) -> anyhow::Result<()> { + let doc_id = editor + .documents + .keys() + .nth(index) + .copied() + .ok_or_else(|| anyhow!("no buffer '{}' in editor", index + 1))?; + + editor.switch(doc_id, Action::Replace); + + Ok(()) } fn extend_to_line_start(cx: &mut Context) { diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 60a962735eff..88b4901f7a6e 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -286,8 +286,12 @@ fn goto_buffer_by_index( .parse::() .map_err(|_| anyhow!("'{}' is not a valid index", index_str))?; + if index < 1 { + bail!("indices bellow 1 not supported"); + } + // Convert to zero based index - goto_buffer_by_index_impl(cx.editor, index - 1); + goto_buffer_by_index_impl(cx.editor, index - 1)?; Ok(()) } From b474ab70fbfb557ee74a50a8e7b7137b41f1c1d8 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 16 Nov 2022 15:41:39 +0100 Subject: [PATCH 9/9] Renamed "buffer " to "buffer number " in doc --- book/src/generated/typable-cmd.md | 2 +- helix-term/src/commands/typed.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 8eff1c8bce06..28d577782133 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -9,7 +9,7 @@ | `:buffer-close-others!`, `:bco!`, `:bcloseother!` | Force close all buffers but the currently focused one. | | `:buffer-close-all`, `:bca`, `:bcloseall` | Close all buffers without quitting. | | `:buffer-close-all!`, `:bca!`, `:bcloseall!` | Force close all buffers ignoring unsaved changes without quitting. | -| `:buffer-goto`, `:b` | Goto the buffer . | +| `:buffer-goto`, `:b` | Goto the buffer number . | | `:buffer-next`, `:bn`, `:bnext` | Goto next buffer. | | `:buffer-previous`, `:bp`, `:bprev` | Goto previous buffer. | | `:write`, `:w` | Write changes to disk. Accepts an optional path (:write some/path.txt) | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 88b4901f7a6e..0ed68ab60457 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1838,7 +1838,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "buffer-goto", aliases: &["b"], - doc: "Goto the buffer .", + doc: "Goto the buffer number .", fun: goto_buffer_by_index, completer: Some(completers::buffer_index), },