Add multi_cursor_modifier setting (#9014)

this PR allows users to use `cmd` instead of `alt` as the
`multi_cursor_modifier` for creating multiple cursors/selections

closes #4339

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Max 2024-03-15 03:33:54 +01:00 committed by GitHub
parent e836a979a2
commit 71aaefc5b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 5 deletions

View file

@ -16,6 +16,7 @@ pub struct EditorSettings {
pub vertical_scroll_margin: f32,
pub relative_line_numbers: bool,
pub seed_search_query_from_cursor: SeedQuerySetting,
pub multi_cursor_modifier: MultiCursorModifier,
pub redact_private_values: bool,
#[serde(default)]
pub double_click_in_multibuffer: DoubleClickInMultibuffer,
@ -84,6 +85,16 @@ pub enum ShowScrollbar {
Never,
}
/// The key to use for adding multiple cursors
///
/// Default: alt
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum MultiCursorModifier {
Alt,
Cmd,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
pub struct EditorSettingsContent {
/// Whether the cursor blinks in the editor.
@ -121,7 +132,6 @@ pub struct EditorSettingsContent {
pub scrollbar: Option<ScrollbarContent>,
/// Gutter related settings
pub gutter: Option<GutterContent>,
/// The number of lines to keep above/below the cursor when auto-scrolling.
///
/// Default: 3.
@ -134,7 +144,10 @@ pub struct EditorSettingsContent {
///
/// Default: always
pub seed_search_query_from_cursor: Option<SeedQuerySetting>,
/// The key to use for adding multiple cursors
///
/// Default: alt
pub multi_cursor_modifier: Option<MultiCursorModifier>,
/// Hide the values of variables in `private` files, as defined by the
/// private_files setting. This only changes the visual representation,
/// the values are still present in the file and can be selected / copied / pasted