diff options
| author | Miran Bastaja <mbastaja@sorre.xyz> | 2025-02-21 19:58:56 +0100 |
|---|---|---|
| committer | Miran Bastaja <mbastaja@sorre.xyz> | 2025-02-21 20:03:29 +0100 |
| commit | 0dd0fc1a65a4a5905647b3254aaff3723c088fd0 (patch) | |
| tree | bad2b9dcbdf1e4dd73e23ef4e1d1122e34cf181d | |
| parent | be9d72b282933b6c0e439b78acadb1c67220612d (diff) | |
hyprdesktop: add zed
| -rw-r--r-- | share/cfg/default.nix | 1 | ||||
| -rw-r--r-- | share/cfg/zed/default.nix | 4 | ||||
| -rw-r--r-- | share/cfg/zed/keymap.json5 | 409 |
3 files changed, 414 insertions, 0 deletions
diff --git a/share/cfg/default.nix b/share/cfg/default.nix index e95753c..ee00247 100644 --- a/share/cfg/default.nix +++ b/share/cfg/default.nix @@ -18,5 +18,6 @@ ./emacs.nix ./foot.nix ./email.nix + ./zed ]; } diff --git a/share/cfg/zed/default.nix b/share/cfg/zed/default.nix new file mode 100644 index 0000000..0435dfd --- /dev/null +++ b/share/cfg/zed/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + xdg.configFile."zed/keymap.json".source = ./keymap.json5; +} diff --git a/share/cfg/zed/keymap.json5 b/share/cfg/zed/keymap.json5 new file mode 100644 index 0000000..ae84221 --- /dev/null +++ b/share/cfg/zed/keymap.json5 @@ -0,0 +1,409 @@ +[ + { + "bindings": { + "cmd-k cmd-p": "workspace::ActivatePreviousPane", + "cmd-k cmd-n": "workspace::ActivateNextPane", + "cmd-'": "editor::ToggleCodeActions" + } + }, + { + "context": "Editor", + "bindings": { + "cmd-b": "editor::GoToDefinition", + "alt-cmd-b": "editor::GoToDefinitionSplit", + "cmd-<": "editor::ScrollCursorCenter", + "cmd-g": [ + "editor::SelectNext", + { + "replace_newest": true + } + ], + "ctrl-cmd-g": [ + "editor::SelectPrevious", + { + "replace_newest": true + } + ], + "ctrl-shift-down": "editor::AddSelectionBelow", + "ctrl-shift-up": "editor::AddSelectionAbove", + "cmd-shift-backspace": "editor::DeleteToBeginningOfLine" + } + }, + { + "context": "Editor && mode == full", + "bindings": { + "cmd-r": "outline::Toggle" + } + }, + { + "context": "BufferSearchBar", + "bindings": { + "cmd-f3": "search::SelectNextMatch", + "cmd-shift-f3": "search::SelectPrevMatch" + } + }, + { + "context": "Workspace", + "bindings": { + "cmd-\\": "workspace::ToggleLeftDock", + "cmd-k cmd-b": "workspace::ToggleLeftDock", + "cmd-t": "file_finder::Toggle", + "cmd-shift-r": "project_symbols::Toggle" + } + }, + { + "context": "Pane", + "bindings": { + "alt-cmd-/": "search::ActivateRegexMode", + "ctrl-0": "project_panel::ToggleFocus", + "cmd-1": ["pane::ActivateItem", 0], + "cmd-2": ["pane::ActivateItem", 1], + "cmd-3": ["pane::ActivateItem", 2], + "cmd-4": ["pane::ActivateItem", 3], + "cmd-5": ["pane::ActivateItem", 4], + "cmd-6": ["pane::ActivateItem", 5], + "cmd-7": ["pane::ActivateItem", 6], + "cmd-8": ["pane::ActivateItem", 7], + "cmd-9": "pane::ActivateLastItem" + } + }, + { + "context": "ProjectPanel", + "bindings": { + "ctrl-[": "project_panel::CollapseSelectedEntry", + "ctrl-b": "project_panel::CollapseSelectedEntry", + "alt-b": "project_panel::CollapseSelectedEntry", + "ctrl-]": "project_panel::ExpandSelectedEntry", + "ctrl-f": "project_panel::ExpandSelectedEntry", + "ctrl-shift-c": "project_panel::CopyPath" + } + }, + { + "context": "Editor && vim_mode != helix_normal && vim_operator == none && !VimWaiting", + "bindings": { + "escape": ["vim::SwitchMode", "HelixNormal"] + // "escape": ["vim::HelixNormalAfter"] + } + }, + { + "context": "vim_mode == helix_normal && !menu", + "use_layout_keys": true, + "bindings": { + "space": "vim::Space", + "$": "vim::EndOfLine", + "end": "vim::EndOfLine", + "^": "vim::FirstNonWhitespace", + "_": "vim::StartOfLineDownward", + "g _": "vim::EndOfLineDownward", + "shift-g": "vim::EndOfDocument", + "{": "vim::StartOfParagraph", + "}": "vim::EndOfParagraph", + "(": "vim::SentenceBackward", + ")": "vim::SentenceForward", + "|": "vim::GoToColumn", + "] ]": "vim::NextSectionStart", + "] [": "vim::NextSectionEnd", + "[ [": "vim::PreviousSectionStart", + "[ ]": "vim::PreviousSectionEnd", + "] m": "vim::NextMethodStart", + "] M": "vim::NextMethodEnd", + "[ m": "vim::PreviousMethodStart", + "[ M": "vim::PreviousMethodEnd", + "[ *": "vim::PreviousComment", + "[ /": "vim::PreviousComment", + "] *": "vim::NextComment", + "] /": "vim::NextComment", + // Word motions + "w": "vim::NextWordStart", + "e": "vim::NextWordEnd", + "b": "vim::PreviousWordStart", + // Subword motions + // "w": "vim::NextSubwordStart", + // "b": "vim::PreviousSubwordStart", + // "e": "vim::NextSubwordEnd", + // "g e": "vim::PreviousSubwordEnd", + "shift-w": ["vim::NextWordStart", { "ignorePunctuation": true }], + "shift-e": ["vim::NextWordEnd", { "ignorePunctuation": true }], + "shift-b": ["vim::PreviousWordStart", { "ignorePunctuation": true }], + "g shift-e": ["vim::PreviousWordEnd", { "ignorePunctuation": true }], + "/": "vim::Search", + "g /": "pane::DeploySearch", + "?": ["vim::Search", { "backwards": true }], + "*": "vim::MoveToNext", + "#": "vim::MoveToPrev", + "n": "vim::MoveToNextMatch", + "shift-n": "vim::MoveToPrevMatch", + "%": "vim::Matching", + "] }": ["vim::UnmatchedForward", { "char": "}" }], + "[ {": ["vim::UnmatchedBackward", { "char": "{" }], + "] )": ["vim::UnmatchedForward", { "char": ")" }], + "[ (": ["vim::UnmatchedBackward", { "char": "(" }], + "f": ["vim::PushOperator", { "FindForward": { "before": false } }], + "t": ["vim::PushOperator", { "FindForward": { "before": true } }], + "shift-f": ["vim::PushOperator", { "FindBackward": { "after": false } }], + "shift-t": ["vim::PushOperator", { "FindBackward": { "after": true } }], + "m": ["vim::PushOperator", "Mark"], + "'": ["vim::PushOperator", { "Jump": { "line": true } }], + "`": ["vim::PushOperator", { "Jump": { "line": false } }], + ";": "vim::RepeatFind", + ",": "vim::RepeatFindReversed", + "ctrl-o": "pane::GoBack", + "ctrl-i": "pane::GoForward", + "ctrl-]": "editor::GoToDefinition", + "v": "vim::ToggleVisual", + "shift-v": "vim::ToggleVisualLine", + "ctrl-v": "vim::ToggleVisualBlock", + "ctrl-q": "vim::ToggleVisualBlock", + "shift-k": "editor::Hover", + "shift-r": "vim::ToggleReplace", + "0": "vim::StartOfLine", + "home": "vim::StartOfLine", + "ctrl-f": "vim::PageDown", + "pagedown": "vim::PageDown", + "ctrl-b": "vim::PageUp", + "pageup": "vim::PageUp", + "ctrl-d": "vim::ScrollDown", + "ctrl-u": "vim::ScrollUp", + "ctrl-e": "vim::LineDown", + "ctrl-y": "vim::LineUp", + // "g" commands + "g g": "vim::StartOfDocument", + "g d": "editor::GoToDefinition", + "g shift-d": "editor::GoToDeclaration", + "g shift-i": "editor::GoToImplementation", + "g x": "editor::OpenUrl", + "g f": "editor::OpenFile", + "g shift-l": "vim::SelectPrevious", + "g >": ["editor::SelectNext", { "replace_newest": true }], + "g <": ["editor::SelectPrevious", { "replace_newest": true }], + "g a": "editor::SelectAllMatches", + "g shift-s": "project_symbols::Toggle", + "g .": "editor::ToggleCodeActions", // zed specific + "g shift-a": "editor::FindAllReferences", // zed specific + "g space": "editor::OpenExcerpts", // zed specific + "g *": ["vim::MoveToNext", { "partialWord": true }], + "g #": ["vim::MoveToPrev", { "partialWord": true }], + "g j": ["vim::Down", { "displayLines": true }], + "g down": ["vim::Down", { "displayLines": true }], + "g k": ["vim::Up", { "displayLines": true }], + "g up": ["vim::Up", { "displayLines": true }], + "g $": ["vim::EndOfLine", { "displayLines": true }], + "g end": ["vim::EndOfLine", { "displayLines": true }], + "g 0": ["vim::StartOfLine", { "displayLines": true }], + "g home": ["vim::StartOfLine", { "displayLines": true }], + "g ^": ["vim::FirstNonWhitespace", { "displayLines": true }], + "g v": "vim::RestoreVisualSelection", + "g ]": "editor::GoToDiagnostic", + "g [": "editor::GoToPrevDiagnostic", + "g i": "vim::InsertAtPrevious", + "g ,": "vim::ChangeListNewer", + "g ;": "vim::ChangeListOlder", + "shift-h": "vim::WindowTop", + "shift-m": "vim::WindowMiddle", + "shift-l": "vim::WindowBottom", + "q": "vim::ToggleRecord", + "shift-q": "vim::ReplayLastRecording", + "@": ["vim::PushOperator", "ReplayRegister"], + // z commands + "z enter": ["workspace::SendKeystrokes", "z t ^"], + "z -": ["workspace::SendKeystrokes", "z b ^"], + "z ^": ["workspace::SendKeystrokes", "shift-h k z b ^"], + "z +": ["workspace::SendKeystrokes", "shift-l j z t ^"], + "z t": "editor::ScrollCursorTop", + "z z": "editor::ScrollCursorCenter", + "z .": ["workspace::SendKeystrokes", "z z ^"], + "z b": "editor::ScrollCursorBottom", + "z a": "editor::ToggleFold", + "z shift-a": "editor::ToggleFoldRecursive", + "z c": "editor::Fold", + "z shift-c": "editor::FoldRecursive", + "z o": "editor::UnfoldLines", + "z shift-o": "editor::UnfoldRecursive", + "z f": "editor::FoldSelectedRanges", + "z shift-m": "editor::FoldAll", + "z shift-r": "editor::UnfoldAll", + "shift-z shift-q": ["pane::CloseActiveItem", { "saveIntent": "skip" }], + "shift-z shift-z": ["pane::CloseActiveItem", { "saveIntent": "saveAll" }], + // Count support + "1": ["vim::Number", 1], + "2": ["vim::Number", 2], + "3": ["vim::Number", 3], + "4": ["vim::Number", 4], + "5": ["vim::Number", 5], + "6": ["vim::Number", 6], + "7": ["vim::Number", 7], + "8": ["vim::Number", 8], + "9": ["vim::Number", 9], + "ctrl-w d": "editor::GoToDefinitionSplit", + "ctrl-w g d": "editor::GoToDefinitionSplit", + "ctrl-w shift-d": "editor::GoToTypeDefinitionSplit", + "ctrl-w g shift-d": "editor::GoToTypeDefinitionSplit", + "ctrl-w space": "editor::OpenExcerptsSplit", + "ctrl-w g space": "editor::OpenExcerptsSplit", + "ctrl-6": "pane::AlternateFile", + + "escape": "editor::Cancel", + "ctrl-[": "editor::Cancel", + ":": "command_palette::Toggle", + ".": "vim::Repeat", + "shift-d": "vim::DeleteToEndOfLine", + "shift-j": "vim::JoinLines", + "y": "vim::Yank", + "shift-y": "vim::YankLine", + "i": "vim::InsertBefore", + "shift-i": "vim::InsertFirstNonWhitespace", + "a": "vim::InsertAfter", + "shift-a": "vim::InsertEndOfLine", + "x": "vim::DeleteRight", + "shift-x": "vim::DeleteLeft", + "o": "vim::InsertLineBelow", + "shift-o": "vim::InsertLineAbove", + "~": "vim::ChangeCase", + "ctrl-a": "vim::Increment", + "ctrl-x": "vim::Decrement", + "p": "vim::Paste", + "shift-p": ["vim::Paste", { "before": true }], + "u": "vim::Undo", + "ctrl-r": "vim::Redo", + "r": ["vim::PushOperator", "Replace"], + "s": "vim::Substitute", + "shift-s": "vim::SubstituteLine", + ">": ["vim::PushOperator", "Indent"], + "<": ["vim::PushOperator", "Outdent"], + "=": ["vim::PushOperator", "AutoIndent"], + "g u": ["vim::PushOperator", "Lowercase"], + "g shift-u": ["vim::PushOperator", "Uppercase"], + "g ~": ["vim::PushOperator", "OppositeCase"], + "\"": ["vim::PushOperator", "Register"], + "g q": ["vim::PushOperator", "Rewrap"], + "g w": ["vim::PushOperator", "Rewrap"], + "ctrl-pagedown": "pane::ActivateNextItem", + "ctrl-pageup": "pane::ActivatePrevItem", + "insert": "vim::InsertBefore", + // tree-sitter related commands + "[ x": "editor::SelectLargerSyntaxNode", + "] x": "editor::SelectSmallerSyntaxNode", + "] d": "editor::GoToDiagnostic", + "[ d": "editor::GoToPrevDiagnostic", + "] c": "editor::GoToHunk", + "[ c": "editor::GoToPrevHunk", + // Goto mode + "g n": "pane::ActivateNextItem", + "g p": "pane::ActivatePrevItem", + // "tab": "pane::ActivateNextItem", + // "shift-tab": "pane::ActivatePrevItem", + "H": "pane::ActivatePrevItem", + "L": "pane::ActivateNextItem", + "g l": "vim::EndOfLine", + "g h": "vim::StartOfLine", + "g s": "vim::FirstNonWhitespace", // "g s" default behavior is "space s" + "g e": "vim::EndOfDocument", + "g y": "editor::GoToTypeDefinition", + "g r": "editor::FindAllReferences", // zed specific + "g t": "vim::WindowTop", + "g c": "vim::WindowMiddle", + "g b": "vim::WindowBottom", + // Window mode + "space w h": ["workspace::ActivatePaneInDirection", "Left"], + "space w l": ["workspace::ActivatePaneInDirection", "Right"], + "space w k": ["workspace::ActivatePaneInDirection", "Up"], + "space w j": ["workspace::ActivatePaneInDirection", "Down"], + "space w q": "pane::CloseActiveItem", + "space w s": "pane::SplitRight", + "space w r": "pane::SplitRight", + "space w v": "pane::SplitDown", + "space w d": "pane::SplitDown", + // Space mode + "space f": "file_finder::Toggle", + "space k": "editor::Hover", + "space s": "outline::Toggle", + "space shift-s": "project_symbols::Toggle", + "space d": "editor::GoToDiagnostic", + "space shift-d": "diagnostics::Deploy", + "space r": "editor::Rename", + "space a": "editor::ToggleCodeActions", + "space h": "editor::SelectAllMatches", + "space c": "editor::ToggleComments", + "space y": "editor::Copy", + "space p": "editor::Paste", + // Match mode + "m m": "vim::Matching", + "m i w": ["workspace::SendKeystrokes", "v i w"], + // Misc + "ctrl-k": "editor::MoveLineUp", + "ctrl-j": "editor::MoveLineDown", + // "ctrl-v": "editor::Paste", + "shift-u": "editor::Redo", + "ctrl-c": "editor::ToggleComments", + "d": "editor::Delete", // TODO: yank first + } + }, + + { + "context": "Editor && vim_mode == visual || vim_mode == helix_normal && !VimWaiting && !VimObject", + "bindings": { + "x": "editor::SelectLine" + } + }, + { + "context": "Editor && vim_mode == visual || vim_mode == helix_normal && !VimWaiting && !VimObject", + "bindings": { + "x": "editor::SelectLine" + } + }, + { + "context": "Editor && (showing_code_actions || showing_completions)", + "bindings": { + "ctrl-j": "editor::ContextMenuNext", + "ctrl-k": "editor::ContextMenuPrev" + } + }, + { + "context": "Editor && VimControl && (vim_mode == helix_normal || vim_mode == visual) && !VimWaiting && !menu", + "bindings": { + // put key-bindings here if you want them to work in normal & visual mode + } + }, + { + "context": "Editor && VimControl && vim_mode == Visual && !VimWaiting && !menu", + "bindings": { + // put key-bindings here if you want them to work only in normal mode + } + }, + { + "context": "Editor && VimControl && vim_mode == visual && !VimWaiting && !menu", + "bindings": { + "A": "vim::InsertAfter", + "i": "vim::InsertBefore", + "a": "vim::InsertAtPrevious", + // visual, visual line & visual block modes + "b": ["workspace::SendKeystrokes", "v v ctrl-shift-alt-b"], + "w": ["workspace::SendKeystrokes", "v v ctrl-shift-alt-w"], + "e": ["workspace::SendKeystrokes", "v v ctrl-shift-alt-e"], + // "w": "editor::SelectToNextWordEnd", + // "b": "editor::SelectToPreviousWordStart", + // "e": "editor::SelectToNextSubwordEnd", + ";": ["vim::SwitchMode", "Normal"], + "": "editor::SplitSelectionIntoLines", + "x": ["workspace::SendKeystrokes", "j g l"], + "C": ["workspace::SendKeystrokes", "j"] + } + }, + { + "context": "Editor && VimControl && vim_mode == insert && !menu", + "bindings": { + // put key-bindings here if you want them to work in insert mode + } + }, + { + "context": "Dock", + "bindings": { + // Window mode + "ctrl-w h": ["workspace::ActivatePaneInDirection", "Left"], + "ctrl-w l": ["workspace::ActivatePaneInDirection", "Right"], + "ctrl-w k": ["workspace::ActivatePaneInDirection", "Up"], + "ctrl-w j": ["workspace::ActivatePaneInDirection", "Down"] + } + } +] + |
