diff --git a/Cargo.lock b/Cargo.lock index fb94d1e0809f..802bf8ba2dab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -885,18 +885,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.139" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.139" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" dependencies = [ "proc-macro2", "quote", diff --git a/book/src/configuration.md b/book/src/configuration.md index 4eab4a48aa78..5372b9f03c43 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -38,7 +38,7 @@ hidden = false | `shell` | Shell to use when running external commands. | Unix: `["sh", "-c"]`
Windows: `["cmd", "/C"]` | | `line-number` | Line number display: `absolute` simply shows each line's number, while `relative` shows the distance from the current line. When unfocused or in insert mode, `relative` will still show absolute line numbers. | `absolute` | | `cursorline` | Highlight all lines with a cursor. | `false` | -| `gutters` | Gutters to display: Available are `diagnostics` and `line-numbers` and `padding`, note that `diagnostics` also includes other features like breakpoints | `["diagnostics", "line-numbers", "padding"]` | +| `gutters` | Gutters to display: Available are `diagnostics` and `line-numbers` and `spacer`, note that `diagnostics` also includes other features like breakpoints, 1-width padding will be inserted if gutters is non-empty | `["diagnostics", "line-numbers"]` | | `auto-completion` | Enable automatic pop up of auto-completion. | `true` | | `auto-format` | Enable automatic formatting on save. | `true` | | `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant. | `400` | @@ -78,6 +78,8 @@ The following elements can be configured: | `diagnostics` | The number of warnings and/or errors | | `selections` | The number of active selections | | `position` | The cursor position | +| `position-percentage` | The cursor position as a percentage of the total number of lines | +| `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) | ### `[editor.lsp]` Section diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 21371c9334f1..6b938def1eef 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -34,12 +34,13 @@ | glsl | ✓ | ✓ | ✓ | | | go | ✓ | ✓ | ✓ | `gopls` | | gomod | ✓ | | | `gopls` | +| gotmpl | ✓ | | | `gopls` | | gowork | ✓ | | | `gopls` | | graphql | ✓ | | | | | hare | ✓ | | ✓ | | | haskell | ✓ | | | `haskell-language-server-wrapper` | | hcl | ✓ | | ✓ | `terraform-ls` | -| heex | ✓ | | | | +| heex | ✓ | ✓ | | | | html | ✓ | | | `vscode-html-language-server` | | idris | | | | `idris2-lsp` | | iex | ✓ | | | | diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 6e6beab4b40f..653acf60cac1 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -1,18 +1,18 @@ | Name | Description | | --- | --- | | `:quit`, `:q` | Close the current view. | -| `:quit!`, `:q!` | Close the current view forcefully (ignoring unsaved changes). | +| `:quit!`, `:q!` | Force close the current view, ignoring unsaved changes. | | `:open`, `:o` | Open a file from disk into the current view. | | `:buffer-close`, `:bc`, `:bclose` | Close the current buffer. | -| `:buffer-close!`, `:bc!`, `:bclose!` | Close the current buffer forcefully (ignoring unsaved changes). | +| `:buffer-close!`, `:bc!`, `:bclose!` | Close the current buffer forcefully, ignoring unsaved changes. | | `:buffer-close-others`, `:bco`, `:bcloseother` | Close all buffers but the currently focused one. | -| `:buffer-close-others!`, `:bco!`, `:bcloseother!` | Close all buffers but the currently focused one. | -| `:buffer-close-all`, `:bca`, `:bcloseall` | Close all buffers, without quitting. | -| `:buffer-close-all!`, `:bca!`, `:bcloseall!` | Close all buffers forcefully (ignoring unsaved changes), without quitting. | -| `:buffer-next`, `:bn`, `:bnext` | Go to next buffer. | -| `:buffer-previous`, `:bp`, `:bprev` | Go to previous buffer. | +| `: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-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) | -| `:write!`, `:w!` | Write changes to disk forcefully (creating necessary subdirectories). Accepts an optional path (:write some/path.txt) | +| `:write!`, `:w!` | Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write some/path.txt) | | `:new`, `:n` | Create a new scratch buffer. | | `:format`, `:fmt` | Format the file using the LSP formatter. | | `:indent-style` | Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.) | @@ -25,9 +25,9 @@ | `:write-quit-all`, `:wqa`, `:xa` | Write changes from all buffers to disk and close all views. | | `:write-quit-all!`, `:wqa!`, `:xa!` | Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes). | | `:quit-all`, `:qa` | Close all views. | -| `:quit-all!`, `:qa!` | Close all views forcefully (ignoring unsaved changes). | +| `:quit-all!`, `:qa!` | Force close all views ignoring unsaved changes. | | `:cquit`, `:cq` | Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2). | -| `:cquit!`, `:cq!` | Quit with exit code (default 1) forcefully (ignoring unsaved changes). Accepts an optional integer exit code (:cq! 2). | +| `:cquit!`, `:cq!` | Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2). | | `:theme` | Change the editor theme. | | `:clipboard-yank` | Yank main selection into system clipboard. | | `:clipboard-yank-join` | Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline. | @@ -42,7 +42,7 @@ | `:show-clipboard-provider` | Show clipboard provider name in status bar. | | `:change-current-directory`, `:cd` | Change the current working directory. | | `:show-directory`, `:pwd` | Show the current working directory. | -| `:encoding` | Set encoding based on `https://encoding.spec.whatwg.org` | +| `:encoding` | Set encoding. Based on `https://encoding.spec.whatwg.org`. | | `:reload` | Discard changes and reload from the source file. | | `:tree-sitter-scopes` | Display tree sitter scopes, primarily for theming and development. | | `:debug-start`, `:dbg` | Start a debug session from a given template with given parameters. | @@ -53,7 +53,7 @@ | `:hsplit`, `:hs`, `:sp` | Open the file in a horizontal split. | | `:hsplit-new`, `:hnew` | Open a scratch buffer in a horizontal split. | | `:tutor` | Open the tutorial. | -| `:goto`, `:g` | Go to line number. | +| `:goto`, `:g` | Goto line number. | | `:set-language`, `:lang` | Set the language of current buffer. | | `:set-option`, `:set` | Set a config option at runtime.
For example to disable smart case search, use `:set search.smart-case false`. | | `:get-option`, `:get` | Get the current value of a config option. | @@ -61,8 +61,8 @@ | `:rsort` | Sort ranges in selection in reverse order. | | `:reflow` | Hard-wrap the current selection of lines to a given width. | | `:tree-sitter-subtree`, `:ts-subtree` | Display tree sitter subtree under cursor, primarily for debugging queries. | -| `:config-reload` | Refreshes helix's config. | -| `:config-open` | Open the helix config.toml file. | +| `:config-reload` | Refresh user config. | +| `:config-open` | Open the user config.toml file. | | `:log-open` | Open the helix log file. | | `:insert-output` | Run shell command, inserting output after each selection. | | `:append-output` | Run shell command, appending output after each selection. | diff --git a/book/src/keymap.md b/book/src/keymap.md index 9acbd3b6b49c..25f1943de9d2 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -1,7 +1,27 @@ # Keymap -- Mappings marked (**LSP**) require an active language server for the file. -- Mappings marked (**TS**) require a tree-sitter grammar for the filetype. +- [Normal mode](#normal-mode) + - [Movement](#movement) + - [Changes](#changes) + - [Shell](#shell) + - [Selection manipulation](#selection-manipulation) + - [Search](#search) + - [Minor modes](#minor-modes) + - [View mode](#view-mode) + - [Goto mode](#goto-mode) + - [Match mode](#match-mode) + - [Window mode](#window-mode) + - [Space mode](#space-mode) + - [Popup](#popup) + - [Unimpaired](#unimpaired) +- [Insert Mode](#insert-mode) +- [Select / extend mode](#select--extend-mode) +- [Picker](#picker) +- [Prompt](#prompt) + +> 💡 Mappings marked (**LSP**) require an active language server for the file. + +> 💡 Mappings marked (**TS**) require a tree-sitter grammar for the filetype. ## Normal mode @@ -337,7 +357,7 @@ mode before pressing `n` or `N` makes it possible to keep the current selection. Toggling it on and off during your iterative searching allows you to selectively add search terms to your selections. -# Picker +## Picker Keys to use within picker. Remapping currently not supported. @@ -356,7 +376,7 @@ Keys to use within picker. Remapping currently not supported. | `Ctrl-t` | Toggle preview | | `Escape`, `Ctrl-c` | Close picker | -# Prompt +## Prompt Keys to use within prompt, Remapping currently not supported. diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs index 210ad639197d..48a68dc02d2d 100644 --- a/helix-core/src/diagnostic.rs +++ b/helix-core/src/diagnostic.rs @@ -23,6 +23,12 @@ pub struct Range { pub end: usize, } +#[derive(Debug, Eq, Hash, PartialEq, Clone, Deserialize, Serialize)] +pub enum NumberOrString { + Number(i32), + String(String), +} + /// Corresponds to [`lsp_types::Diagnostic`](https://docs.rs/lsp-types/0.91.0/lsp_types/struct.Diagnostic.html) #[derive(Debug, Clone)] pub struct Diagnostic { @@ -30,4 +36,5 @@ pub struct Diagnostic { pub line: usize, pub message: String, pub severity: Option, + pub code: Option, } diff --git a/helix-loader/src/config.rs b/helix-loader/src/config.rs index a8c843612811..259b1318ea00 100644 --- a/helix-loader/src/config.rs +++ b/helix-loader/src/config.rs @@ -19,7 +19,23 @@ pub fn user_lang_config() -> Result { .into_iter() .chain([default_lang_config()].into_iter()) .fold(toml::Value::Table(toml::value::Table::default()), |a, b| { - crate::merge_toml_values(b, a, true) + // combines for example + // b: + // [[language]] + // name = "toml" + // language-server = { command = "taplo", args = ["lsp", "stdio"] } + // + // a: + // [[language]] + // language-server = { command = "/usr/bin/taplo" } + // + // into: + // [[language]] + // name = "toml" + // language-server = { command = "/usr/bin/taplo" } + // + // thus it overrides the third depth-level of b with values of a if they exist, but otherwise merges their values + crate::merge_toml_values(b, a, 3) }); Ok(config) diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index 7aa9bc8346e1..3a8a4918a8c7 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -319,7 +319,7 @@ fn build_tree_sitter_library(src_path: &Path, grammar: GrammarConfiguration) -> command.env(key, value); } - if cfg!(windows) { + if cfg!(all(windows, target_env = "msvc")) { command .args(&["/nologo", "/LD", "/I"]) .arg(header_path) diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index ff4414b2647d..1ba48e7b2d20 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -113,11 +113,7 @@ pub fn find_root_impl(root: Option<&str>, root_markers: &[String]) -> Vec toml::Value { +pub fn merge_toml_values(left: toml::Value, right: toml::Value, merge_depth: usize) -> toml::Value { use toml::Value; fn get_name(v: &Value) -> Option<&str> { @@ -131,7 +127,7 @@ pub fn merge_toml_values( // that you can specify a sub-set of languages in an overriding // `languages.toml` but that nested arrays like Language Server // arguments are replaced instead of merged. - if merge_toplevel_arrays { + if merge_depth > 0 { left_items.reserve(right_items.len()); for rvalue in right_items { let lvalue = get_name(&rvalue) @@ -140,7 +136,7 @@ pub fn merge_toml_values( }) .map(|lpos| left_items.remove(lpos)); let mvalue = match lvalue { - Some(lvalue) => merge_toml_values(lvalue, rvalue, false), + Some(lvalue) => merge_toml_values(lvalue, rvalue, merge_depth - 1), None => rvalue, }; left_items.push(mvalue); @@ -151,18 +147,22 @@ pub fn merge_toml_values( } } (Value::Table(mut left_map), Value::Table(right_map)) => { - for (rname, rvalue) in right_map { - match left_map.remove(&rname) { - Some(lvalue) => { - let merged_value = merge_toml_values(lvalue, rvalue, merge_toplevel_arrays); - left_map.insert(rname, merged_value); - } - None => { - left_map.insert(rname, rvalue); + if merge_depth > 0 { + for (rname, rvalue) in right_map { + match left_map.remove(&rname) { + Some(lvalue) => { + let merged_value = merge_toml_values(lvalue, rvalue, merge_depth - 1); + left_map.insert(rname, merged_value); + } + None => { + left_map.insert(rname, rvalue); + } } } + Value::Table(left_map) + } else { + Value::Table(right_map) } - Value::Table(left_map) } // Catch everything else we didn't handle, and use the right value (_, value) => value, @@ -187,7 +187,7 @@ mod merge_toml_tests { .expect("Couldn't parse built-in languages config"); let user: Value = toml::from_str(USER).unwrap(); - let merged = merge_toml_values(base, user, true); + let merged = merge_toml_values(base, user, 3); let languages = merged.get("language").unwrap().as_array().unwrap(); let nix = languages .iter() @@ -220,7 +220,7 @@ mod merge_toml_tests { .expect("Couldn't parse built-in languages config"); let user: Value = toml::from_str(USER).unwrap(); - let merged = merge_toml_values(base, user, true); + let merged = merge_toml_values(base, user, 3); let languages = merged.get("language").unwrap().as_array().unwrap(); let ts = languages .iter() diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 6a5f9d5ca4f7..b6e364239ff1 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -58,7 +58,7 @@ pub enum OffsetEncoding { pub mod util { use super::*; - use helix_core::{Range, Rope, Transaction}; + use helix_core::{diagnostic::NumberOrString, Range, Rope, Transaction}; /// Converts a diagnostic in the document to [`lsp::Diagnostic`]. /// @@ -78,11 +78,19 @@ pub mod util { Error => lsp::DiagnosticSeverity::ERROR, }); + let code = match diag.code.clone() { + Some(x) => match x { + NumberOrString::Number(x) => Some(lsp::NumberOrString::Number(x)), + NumberOrString::String(x) => Some(lsp::NumberOrString::String(x)), + }, + None => None, + }; + // TODO: add support for Diagnostic.data lsp::Diagnostic::new( range_to_lsp_range(doc, range, offset_encoding), severity, - None, + code, None, diag.message.to_owned(), None, diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 3ee5481f1f0c..737b1cadf029 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -2,6 +2,7 @@ use arc_swap::{access::Map, ArcSwap}; use futures_util::Stream; use helix_core::{ config::{default_syntax_loader, user_syntax_loader}, + diagnostic::NumberOrString, pos_at_coords, syntax, Selection, }; use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap}; @@ -556,12 +557,24 @@ impl Application { } }; + let code = match diagnostic.code.clone() { + Some(x) => match x { + lsp::NumberOrString::Number(x) => { + Some(NumberOrString::Number(x)) + } + lsp::NumberOrString::String(x) => { + Some(NumberOrString::String(x)) + } + }, + None => None, + }; + Some(Diagnostic { range: Range { start, end }, line: diagnostic.range.start.line as usize, message: diagnostic.message.clone(), severity, - // code + code, // source }) }) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index bd1bd8945029..3adb1f29b901 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -204,17 +204,17 @@ impl MappableCommand { extend_line_down, "Extend down", copy_selection_on_next_line, "Copy selection on next line", copy_selection_on_prev_line, "Copy selection on previous line", - move_next_word_start, "Move to beginning of next word", - move_prev_word_start, "Move to beginning of previous word", + move_next_word_start, "Move to start of next word", + move_prev_word_start, "Move to start of previous word", move_prev_word_end, "Move to end of previous word", move_next_word_end, "Move to end of next word", - move_next_long_word_start, "Move to beginning of next long word", - move_prev_long_word_start, "Move to beginning of previous long word", + move_next_long_word_start, "Move to start of next long word", + move_prev_long_word_start, "Move to start of previous long word", move_next_long_word_end, "Move to end of next long word", - extend_next_word_start, "Extend to beginning of next word", - extend_prev_word_start, "Extend to beginning of previous word", - extend_next_long_word_start, "Extend to beginning of next long word", - extend_prev_long_word_start, "Extend to beginning of previous long word", + extend_next_word_start, "Extend to start of next word", + extend_prev_word_start, "Extend to start of previous word", + extend_next_long_word_start, "Extend to start of next long word", + extend_prev_long_word_start, "Extend to start of previous long word", extend_next_long_word_end, "Extend to end of next long word", extend_next_word_end, "Extend to end of next word", find_till_char, "Move till next occurrence of char", @@ -225,7 +225,7 @@ impl MappableCommand { find_prev_char, "Move to previous occurrence of char", extend_till_prev_char, "Extend till previous occurrence of char", extend_prev_char, "Extend to previous occurrence of char", - repeat_last_motion, "repeat last motion(extend_next_char, extend_till_char, find_next_char, find_till_char...)", + repeat_last_motion, "Repeat last motion", replace, "Replace with new char", switch_case, "Switch (toggle) case", switch_to_uppercase, "Switch to uppercase", @@ -236,7 +236,7 @@ impl MappableCommand { half_page_down, "Move half page down", select_all, "Select whole document", select_regex, "Select all regex matches inside selections", - split_selection, "Split selection into subselections on regex matches", + split_selection, "Split selections on regex matches", split_selection_on_newline, "Split selection on newlines", search, "Search for regex pattern", rsearch, "Reverse search for regex pattern", @@ -245,20 +245,20 @@ impl MappableCommand { extend_search_next, "Add next search match to selection", extend_search_prev, "Add previous search match to selection", search_selection, "Use current selection as search pattern", - global_search, "Global Search in workspace folder", + global_search, "Global search in workspace folder", extend_line, "Select current line, if already selected, extend to next line", extend_line_above, "Select current line, if already selected, extend to previous line", - extend_to_line_bounds, "Extend selection to line bounds (line-wise selection)", - shrink_to_line_bounds, "Shrink selection to line bounds (line-wise selection)", + extend_to_line_bounds, "Extend selection to line bounds", + shrink_to_line_bounds, "Shrink selection to line bounds", delete_selection, "Delete selection", - delete_selection_noyank, "Delete selection, without yanking", - change_selection, "Change selection (delete and enter insert mode)", - change_selection_noyank, "Change selection (delete and enter insert mode, without yanking)", - collapse_selection, "Collapse selection onto a single cursor", + delete_selection_noyank, "Delete selection without yanking", + change_selection, "Change selection", + change_selection_noyank, "Change selection without yanking", + collapse_selection, "Collapse selection into single cursor", flip_selections, "Flip selection cursor and anchor", - ensure_selections_forward, "Ensure the selection is in forward direction", + ensure_selections_forward, "Ensure all selections face forward", insert_mode, "Insert before selection", - append_mode, "Insert after selection (append)", + append_mode, "Append after selection", command_mode, "Enter command mode", file_picker, "Open file picker", file_picker_in_current_directory, "Open file picker at current working directory", @@ -272,7 +272,7 @@ impl MappableCommand { workspace_diagnostics_picker, "Open workspace diagnostic picker", last_picker, "Open last picker", prepend_to_line, "Insert at start of line", - append_to_line, "Insert at end of line", + append_to_line, "Append to end of line", open_below, "Open new line below selection", open_above, "Open new line above selection", normal_mode, "Enter normal mode", @@ -319,13 +319,13 @@ impl MappableCommand { delete_char_forward, "Delete next char", delete_word_backward, "Delete previous word", delete_word_forward, "Delete next word", - kill_to_line_start, "Delete content till the start of the line", - kill_to_line_end, "Delete content till the end of the line", + kill_to_line_start, "Delete till start of line", + kill_to_line_end, "Delete till end of line", undo, "Undo change", redo, "Redo change", earlier, "Move backward in history", later, "Move forward in history", - commit_undo_checkpoint, "Commit changes to a new checkpoint", + commit_undo_checkpoint, "Commit changes to new checkpoint", yank, "Yank selection", yank_joined_to_clipboard, "Join and yank selections to clipboard", yank_main_selection_to_clipboard, "Yank main selection to clipboard", @@ -333,7 +333,7 @@ impl MappableCommand { yank_main_selection_to_primary_clipboard, "Yank main selection to primary clipboard", replace_with_yanked, "Replace with yanked text", replace_selections_with_clipboard, "Replace selections by clipboard content", - replace_selections_with_primary_clipboard, "Replace selections by primary clipboard content", + replace_selections_with_primary_clipboard, "Replace selections by primary clipboard", paste_after, "Paste after selection", paste_before, "Paste before selection", paste_clipboard_after, "Paste clipboard after selections", @@ -358,19 +358,19 @@ impl MappableCommand { rotate_selection_contents_backward, "Rotate selections contents backward", expand_selection, "Expand selection to parent syntax node", shrink_selection, "Shrink selection to previously expanded syntax node", - select_next_sibling, "Select the next sibling in the syntax tree", - select_prev_sibling, "Select the previous sibling in the syntax tree", + select_next_sibling, "Select next sibling in syntax tree", + select_prev_sibling, "Select previous sibling in syntax tree", jump_forward, "Jump forward on jumplist", jump_backward, "Jump backward on jumplist", - save_selection, "Save the current selection to the jumplist", - jump_view_right, "Jump to the split to the right", - jump_view_left, "Jump to the split to the left", - jump_view_up, "Jump to the split above", - jump_view_down, "Jump to the split below", - swap_view_right, "Swap with the split to the right", - swap_view_left, "Swap with the split to the left", - swap_view_up, "Swap with the split above", - swap_view_down, "Swap with the split below", + save_selection, "Save current selection to jumplist", + jump_view_right, "Jump to right split", + jump_view_left, "Jump to left split", + jump_view_up, "Jump to split above", + jump_view_down, "Jump to split below", + swap_view_right, "Swap with right split", + swap_view_left, "Swap with left split", + swap_view_up, "Swap with split above", + swap_view_down, "Swap with split below", transpose_view, "Transpose splits", rotate_view, "Goto next window", hsplit, "Horizontal bottom split", @@ -378,7 +378,7 @@ impl MappableCommand { vsplit, "Vertical right split", vsplit_new, "Vertical right split scratch buffer", wclose, "Close window", - wonly, "Current window only", + wonly, "Close windows except current", select_register, "Select register", insert_register, "Insert register", align_view_middle, "Align view middle", @@ -414,21 +414,21 @@ impl MappableCommand { dap_next, "Step to next", dap_variables, "List variables", dap_terminate, "End debug session", - dap_edit_condition, "Edit condition of the breakpoint on the current line", - dap_edit_log, "Edit log message of the breakpoint on the current line", + dap_edit_condition, "Edit breakpoint condition on current line", + dap_edit_log, "Edit breakpoint log message on current line", dap_switch_thread, "Switch current thread", dap_switch_stack_frame, "Switch stack frame", dap_enable_exceptions, "Enable exception breakpoints", dap_disable_exceptions, "Disable exception breakpoints", shell_pipe, "Pipe selections through shell command", - shell_pipe_to, "Pipe selections into shell command, ignoring command output", - shell_insert_output, "Insert output of shell command before each selection", - shell_append_output, "Append output of shell command after each selection", + shell_pipe_to, "Pipe selections into shell command ignoring output", + shell_insert_output, "Insert shell command output before selections", + shell_append_output, "Append shell command output after selections", shell_keep_pipe, "Filter selections with shell predicate", - suspend, "Suspend", + suspend, "Suspend and return to shell", rename_symbol, "Rename symbol", - increment, "Increment", - decrement, "Decrement", + increment, "Increment item under cursor", + decrement, "Decrement item under cursor", record_macro, "Record macro", replay_macro, "Replay macro", command_palette, "Open command palette", diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index d6db117e67e4..f6eedea9567a 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1525,7 +1525,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "quit!", aliases: &["q!"], - doc: "Close the current view forcefully (ignoring unsaved changes).", + doc: "Force close the current view, ignoring unsaved changes.", fun: force_quit, completer: None, }, @@ -1546,7 +1546,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "buffer-close!", aliases: &["bc!", "bclose!"], - doc: "Close the current buffer forcefully (ignoring unsaved changes).", + doc: "Close the current buffer forcefully, ignoring unsaved changes.", fun: force_buffer_close, completer: Some(completers::buffer), }, @@ -1560,35 +1560,35 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "buffer-close-others!", aliases: &["bco!", "bcloseother!"], - doc: "Close all buffers but the currently focused one.", + doc: "Force close all buffers but the currently focused one.", fun: force_buffer_close_others, completer: None, }, TypableCommand { name: "buffer-close-all", aliases: &["bca", "bcloseall"], - doc: "Close all buffers, without quitting.", + doc: "Close all buffers without quitting.", fun: buffer_close_all, completer: None, }, TypableCommand { name: "buffer-close-all!", aliases: &["bca!", "bcloseall!"], - doc: "Close all buffers forcefully (ignoring unsaved changes), without quitting.", + doc: "Force close all buffers ignoring unsaved changes without quitting.", fun: force_buffer_close_all, completer: None, }, TypableCommand { name: "buffer-next", aliases: &["bn", "bnext"], - doc: "Go to next buffer.", + doc: "Goto next buffer.", fun: buffer_next, completer: None, }, TypableCommand { name: "buffer-previous", aliases: &["bp", "bprev"], - doc: "Go to previous buffer.", + doc: "Goto previous buffer.", fun: buffer_previous, completer: None, }, @@ -1602,7 +1602,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "write!", aliases: &["w!"], - doc: "Write changes to disk forcefully (creating necessary subdirectories). Accepts an optional path (:write some/path.txt)", + doc: "Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write some/path.txt)", fun: force_write, completer: Some(completers::filename), }, @@ -1696,7 +1696,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "quit-all!", aliases: &["qa!"], - doc: "Close all views forcefully (ignoring unsaved changes).", + doc: "Force close all views ignoring unsaved changes.", fun: force_quit_all, completer: None, }, @@ -1710,7 +1710,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "cquit!", aliases: &["cq!"], - doc: "Quit with exit code (default 1) forcefully (ignoring unsaved changes). Accepts an optional integer exit code (:cq! 2).", + doc: "Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2).", fun: force_cquit, completer: None, }, @@ -1815,7 +1815,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "encoding", aliases: &[], - doc: "Set encoding based on `https://encoding.spec.whatwg.org`", + doc: "Set encoding. Based on `https://encoding.spec.whatwg.org`.", fun: set_encoding, completer: None, }, @@ -1892,7 +1892,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "goto", aliases: &["g"], - doc: "Go to line number.", + doc: "Goto line number.", fun: goto_line_number, completer: None, }, @@ -1948,14 +1948,14 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "config-reload", aliases: &[], - doc: "Refreshes helix's config.", + doc: "Refresh user config.", fun: refresh_config, completer: None, }, TypableCommand { name: "config-open", aliases: &[], - doc: "Open the helix config.toml file.", + doc: "Open the user config.toml file.", fun: open_config, completer: None, }, diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 85992c602164..df6d4800065c 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -1,4 +1,4 @@ -use helix_core::{coords_at_pos, encoding}; +use helix_core::{coords_at_pos, encoding, Position}; use helix_view::{ document::{Mode, SCRATCH_BUFFER_NAME}, graphics::Rect, @@ -143,6 +143,8 @@ where helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics, helix_view::editor::StatusLineElement::Selections => render_selections, helix_view::editor::StatusLineElement::Position => render_position, + helix_view::editor::StatusLineElement::PositionPercentage => render_position_percentage, + helix_view::editor::StatusLineElement::Spacer => render_spacer, } } @@ -250,19 +252,22 @@ where ); } -fn render_position(context: &mut RenderContext, write: F) -where - F: Fn(&mut RenderContext, String, Option