From c8696149b8cf8531d6555b82171f39fee668cb93 Mon Sep 17 00:00:00 2001 From: Joseph Lyons Date: Mon, 13 Mar 2023 08:27:04 -0400 Subject: [PATCH] Add TextMate keymap --- assets/keymaps/atom.json | 2 +- assets/keymaps/jetbrains.json | 2 +- assets/keymaps/sublime_text.json | 2 +- assets/keymaps/textmate.json | 90 ++++++++++++++++++++++++++++++++ crates/settings/src/settings.rs | 11 ++-- 5 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 assets/keymaps/textmate.json diff --git a/assets/keymaps/atom.json b/assets/keymaps/atom.json index 766c46c133..82b0b438e5 100644 --- a/assets/keymaps/atom.json +++ b/assets/keymaps/atom.json @@ -65,4 +65,4 @@ "context": "Dock", "bindings": {} } -] \ No newline at end of file +] diff --git a/assets/keymaps/jetbrains.json b/assets/keymaps/jetbrains.json index 2e6e5e77e6..921efdc929 100644 --- a/assets/keymaps/jetbrains.json +++ b/assets/keymaps/jetbrains.json @@ -75,4 +75,4 @@ "alt-f12": "dock::HideDock" } } -] \ No newline at end of file +] diff --git a/assets/keymaps/sublime_text.json b/assets/keymaps/sublime_text.json index 1d3dd887d7..89cfa4b262 100644 --- a/assets/keymaps/sublime_text.json +++ b/assets/keymaps/sublime_text.json @@ -57,4 +57,4 @@ "ctrl-`": "dock::HideDock" } } -] \ No newline at end of file +] diff --git a/assets/keymaps/textmate.json b/assets/keymaps/textmate.json new file mode 100644 index 0000000000..88648b89e3 --- /dev/null +++ b/assets/keymaps/textmate.json @@ -0,0 +1,90 @@ +[ + { + "bindings": { + "cmd-shift-o": "projects::OpenRecent", + "cmd-alt-tab": "project_panel::ToggleFocus" + } + }, + { + "context": "Editor", + "bindings": { + "cmd-l": "go_to_line::Toggle", + "ctrl-shift-d": "editor::DuplicateLine", + "cmd-b": "editor::GoToDefinition", + "cmd-j": "editor::ScrollCursorCenter", + "cmd-enter": "editor::NewlineBelow", + "cmd-shift-l": "editor::SelectLine", + "cmd-shift-t": "outline::Toggle", + "alt-backspace": "editor::DeleteToPreviousWordStart", + "alt-shift-backspace": "editor::DeleteToNextWordEnd", + "alt-delete": "editor::DeleteToNextWordEnd", + "alt-shift-delete": "editor::DeleteToNextWordEnd", + "ctrl-backspace": "editor::DeleteToPreviousSubwordStart", + "ctrl-delete": "editor::DeleteToNextSubwordEnd", + "alt-left": [ + "editor::MoveToPreviousWordStart", + { + "stop_at_soft_wraps": true + } + ], + "alt-right": [ + "editor::MoveToNextWordEnd", + { + "stop_at_soft_wraps": true + } + ], + "ctrl-left": "editor::MoveToPreviousSubwordStart", + "ctrl-right": "editor::MoveToNextSubwordEnd", + "cmd-shift-left": "editor::SelectToBeginningOfLine", + "cmd-shift-right": "editor::SelectToEndOfLine", + "alt-shift-left": [ + "editor::SelectToBeginningOfLine", + { + "stop_at_soft_wraps": true + } + ], + "alt-shift-right": [ + "editor::SelectToEndOfLine", + { + "stop_at_soft_wraps": true + } + ], + "ctrl-shift-left": "editor::SelectToPreviousSubwordStart", + "ctrl-shift-right": "editor::SelectToNextSubwordEnd" + } + }, + { + "context": "Editor && mode == full", + "bindings": {} + }, + { + "context": "BufferSearchBar", + "bindings": { + "ctrl-s": "search::SelectNextMatch", + "ctrl-shift-s": "search::SelectPrevMatch" + } + }, + { + "context": "Workspace", + "bindings": { + "cmd-alt-ctrl-d": "workspace::ToggleLeftSidebar", + "cmd-t": "file_finder::Toggle", + "cmd-shift-t": "project_symbols::Toggle" + } + }, + { + "context": "Pane", + "bindings": { + "alt-cmd-r": "search::ToggleRegex", + "ctrl-tab": "project_panel::ToggleFocus" + } + }, + { + "context": "ProjectPanel", + "bindings": {} + }, + { + "context": "Dock", + "bindings": {} + } +] diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index 49f43e7a2d..de3e150763 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -63,23 +63,26 @@ pub enum BaseKeymap { #[default] VSCode, JetBrains, - Sublime, + SublimeText, Atom, + TextMate, } impl BaseKeymap { - pub const OPTIONS: [(&'static str, Self); 4] = [ + pub const OPTIONS: [(&'static str, Self); 5] = [ ("VSCode (Default)", Self::VSCode), ("Atom", Self::Atom), ("JetBrains", Self::JetBrains), - ("Sublime", Self::Sublime), + ("Sublime Text", Self::SublimeText), + ("TextMate", Self::TextMate), ]; pub fn asset_path(&self) -> Option<&'static str> { match self { BaseKeymap::JetBrains => Some("keymaps/jetbrains.json"), - BaseKeymap::Sublime => Some("keymaps/sublime_text.json"), + BaseKeymap::SublimeText => Some("keymaps/sublime_text.json"), BaseKeymap::Atom => Some("keymaps/atom.json"), + BaseKeymap::TextMate => Some("keymaps/textmate.json"), BaseKeymap::VSCode => None, } }