From 67619386cdd7537f0ab9af77e701409e97a87917 Mon Sep 17 00:00:00 2001 From: Thomas O'Donnell Date: Sat, 18 Jun 2022 23:23:59 +0200 Subject: [PATCH] fix(character): Standadise Vim config names (#4081) Have switched all vi/vim symbols to have the same prefix 'vim'. To preserve backwards compatibility with existing configs I have added an alias for the previous config name. --- .github/config-schema.json | 4 ++-- docs/config/README.md | 22 +++++++++++----------- src/configs/character.rs | 5 +++-- src/modules/character.rs | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/config-schema.json b/.github/config-schema.json index 7f92be3b..1bea08fe 100644 --- a/.github/config-schema.json +++ b/.github/config-schema.json @@ -122,9 +122,9 @@ "error_symbol": "[❯](bold red)", "format": "$symbol ", "success_symbol": "[❯](bold green)", - "vicmd_symbol": "[❮](bold green)", "vimcmd_replace_one_symbol": "[❮](bold purple)", "vimcmd_replace_symbol": "[❮](bold purple)", + "vimcmd_symbol": "[❮](bold green)", "vimcmd_visual_symbol": "[❮](bold yellow)" }, "allOf": [ @@ -1783,7 +1783,7 @@ "default": "[❯](bold red)", "type": "string" }, - "vicmd_symbol": { + "vimcmd_symbol": { "default": "[❮](bold green)", "type": "string" }, diff --git a/docs/config/README.md b/docs/config/README.md index f1acd4cc..f7965e5d 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -561,7 +561,7 @@ look at [this example](#with-custom-error-shape). ::: warning -`vicmd_symbol` is only supported in cmd, fish and zsh. +`vimcmd_symbol` is only supported in cmd, fish and zsh. `vimcmd_replace_one_symbol`, `vimcmd_replace_symbol`, and `vimcmd_visual_symbol` are only supported in fish due to [upstream issues with mode detection in zsh](https://github.com/starship/starship/issues/625#issuecomment-732454148). @@ -569,16 +569,16 @@ are only supported in fish due to [upstream issues with mode detection in zsh](h ### Options -| Option | Default | Description | -| -------------------------- | -------------------- | --------------------------------------------------------------------------------------- | -| `format` | `"$symbol "` | The format string used before the text input. | -| `success_symbol` | `"[❯](bold green)"` | The format string used before the text input if the previous command succeeded. | -| `error_symbol` | `"[❯](bold red)"` | The format string used before the text input if the previous command failed. | -| `vicmd_symbol` | `"[❮](bold green)"` | The format string used before the text input if the shell is in vim normal mode. | -| `vicmd_replace_one_symbol` | `"[❮](bold purple)"` | The format string used before the text input if the shell is in vim `replace_one` mode. | -| `vimcmd_replace_symbol` | `"[❮](bold purple)"` | The format string used before the text input if the shell is in vim replace mode. | -| `vimcmd_visual_symbol` | `"[❮](bold yellow)"` | The format string used before the text input if the shell is in vim replace mode. | -| `disabled` | `false` | Disables the `character` module. | +| Option | Default | Description | +| --------------------------- | -------------------- | --------------------------------------------------------------------------------------- | +| `format` | `"$symbol "` | The format string used before the text input. | +| `success_symbol` | `"[❯](bold green)"` | The format string used before the text input if the previous command succeeded. | +| `error_symbol` | `"[❯](bold red)"` | The format string used before the text input if the previous command failed. | +| `vimcmd_symbol` | `"[❮](bold green)"` | The format string used before the text input if the shell is in vim normal mode. | +| `vimcmd_replace_one_symbol` | `"[❮](bold purple)"` | The format string used before the text input if the shell is in vim `replace_one` mode. | +| `vimcmd_replace_symbol` | `"[❮](bold purple)"` | The format string used before the text input if the shell is in vim replace mode. | +| `vimcmd_visual_symbol` | `"[❮](bold yellow)"` | The format string used before the text input if the shell is in vim replace mode. | +| `disabled` | `false` | Disables the `character` module. | ### Variables diff --git a/src/configs/character.rs b/src/configs/character.rs index eb28f9cd..27950caf 100644 --- a/src/configs/character.rs +++ b/src/configs/character.rs @@ -7,7 +7,8 @@ pub struct CharacterConfig<'a> { pub format: &'a str, pub success_symbol: &'a str, pub error_symbol: &'a str, - pub vicmd_symbol: &'a str, + #[serde(alias = "vicmd_symbol")] + pub vimcmd_symbol: &'a str, pub vimcmd_visual_symbol: &'a str, pub vimcmd_replace_symbol: &'a str, pub vimcmd_replace_one_symbol: &'a str, @@ -20,7 +21,7 @@ impl<'a> Default for CharacterConfig<'a> { format: "$symbol ", success_symbol: "[❯](bold green)", error_symbol: "[❯](bold red)", - vicmd_symbol: "[❮](bold green)", + vimcmd_symbol: "[❮](bold green)", vimcmd_visual_symbol: "[❮](bold yellow)", vimcmd_replace_symbol: "[❮](bold purple)", vimcmd_replace_one_symbol: "[❮](bold purple)", diff --git a/src/modules/character.rs b/src/modules/character.rs index 39c78b15..f4d9a2ac 100644 --- a/src/modules/character.rs +++ b/src/modules/character.rs @@ -45,7 +45,7 @@ pub fn module<'a>(context: &'a Context) -> Option> { }; let symbol = match mode { - ShellEditMode::Normal => config.vicmd_symbol, + ShellEditMode::Normal => config.vimcmd_symbol, ShellEditMode::Visual => config.vimcmd_visual_symbol, ShellEditMode::Replace => config.vimcmd_replace_symbol, ShellEditMode::ReplaceOne => config.vimcmd_replace_one_symbol,