Created
January 25, 2024 17:02
-
-
Save baldwindavid/da067ef4a39ef09550e56a97bba22f8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Bindings that apply to all contexts | |
{ | |
"bindings": { | |
"cmd-f": "workspace::NewSearch", | |
"cmd-t": "terminal_panel::ToggleFocus" | |
} | |
}, | |
{ | |
"context": "Editor && VimControl && !VimWaiting && !menu", | |
"bindings": { | |
"-": "project_panel::ToggleFocus", | |
// put key-bindings here if you want them to work in normal & visual mode | |
"space w": "workspace::Save", | |
"space q": "pane::CloseActiveItem", | |
"space \\": "pane::SplitRight", | |
"space -": "pane::SplitDown", | |
"space o": "outline::Toggle", | |
"space k": ["workspace::ActivatePaneInDirection", "Up"], | |
"space j": ["workspace::ActivatePaneInDirection", "Down"], | |
"space h": ["workspace::ActivatePaneInDirection", "Left"], | |
"space l": ["workspace::ActivatePaneInDirection", "Right"], | |
"up": "vim::ScrollUp", | |
"down": "vim::ScrollDown", | |
// Let's try to use cmd+p for this | |
// "space p": "file_finder::Toggle", | |
// Let's try to use the : for this in the editor since | |
// it's more consistent with vim | |
// "space space p": "command_palette::Toggle", | |
"left": "pane::GoBack", | |
"right": "pane::GoForward", | |
// Note that this is simpler than the typical vim | |
// commenting plugin (g c c) | |
"g c": [ | |
"editor::ToggleComments", | |
{ | |
"advance_downwards": false | |
} | |
], | |
"g r": "editor::FindAllReferences", | |
// "cgn" appears to not work in Zed | |
// "c g n": "search::ReplaceNext", | |
// Unless Zed ends up supporting a "modal-first" mode, | |
// probably better off just using the muscle memory | |
// of cmd+b that can be used in any mode. | |
// "space b": "project_panel::ToggleFocus", | |
// Let's just use : to get the command palette. We want this | |
// to get the file relative path for tests and hopefully at | |
// some point there is a plugin that can handle testing anyway. | |
// "space c": "editor::CopyRelativePath", | |
// Yay, this appears to work here when it does not in vscode | |
"shift-u": "editor::Redo" | |
} | |
}, | |
{ | |
"context": "Editor && vim_mode == normal && !VimWaiting && !menu", | |
"bindings": { | |
// put key-bindings here if you want them to work only in normal mode | |
} | |
}, | |
{ | |
"context": "Editor && vim_mode == visual && !VimWaiting && !menu", | |
"bindings": { | |
// visual, visual line & visual block modes | |
} | |
}, | |
{ | |
"context": "Editor && vim_mode == insert && !menu", | |
"bindings": { | |
// put key-bindings here if you want them to work in insert mode | |
} | |
}, | |
{ | |
"context": "ProjectPanel && not_editing", | |
"bindings": { | |
"escape": "project_panel::ToggleFocus", | |
"enter": "project_panel::Open", | |
"d": "project_panel::NewDirectory", | |
"%": "project_panel::NewFile", | |
"shift-r": "project_panel::Rename", | |
// These operate differently (which is fine) than in vim in that "marking" | |
// the "target" always comes last. So you would do "m m" to mark the file | |
// you want to move, then "m t" again to mark the target directory. | |
// Copying is the same, with "m c" to mark the file to copy, then "m t" | |
// to mark the target directory. | |
"m m": "project_panel::Cut", | |
"m c": "project_panel::Copy", | |
"m t": "project_panel::Paste", | |
// Open in finder | |
"o": "project_panel::RevealInFinder", | |
// Directory expansion | |
"l": "project_panel::ExpandSelectedEntry", | |
"h": "project_panel::CollapseSelectedEntry", | |
// Move up and down | |
"j": "menu::SelectNext", | |
"k": "menu::SelectPrev", | |
////////////////////////////////////////////////////////// | |
// COMMANDS THAT ARE IN ZED, BUT DON'T WORK JUST RIGHT | |
////////////////////////////////////////////////////////// | |
// After deletion of the last file in a directory we should stay inside | |
// the current directory, but instead it jumps to the root of the project. | |
"shift-d": "project_panel::Delete", | |
////////////////////////////////////////////////////////// | |
// ZED-SPECIFIC COMMANDS | |
////////////////////////////////////////////////////////// | |
// In vim "q f" displays information on a file so tucking these under "q". | |
// Perhaps a different command makes more sense though. | |
"q p": "project_panel::CopyPath", | |
"q r": "project_panel::CopyRelativePath", | |
// Works when the current selection in the project panel is a directory. | |
// I think this should also work when the current selection is a file | |
// on whichever directory that file is in. | |
"/": "project_panel::NewSearchInDirectory" | |
////////////////////////////////////////////////////////// | |
// COMMANDS THAT ARE NOT IN ZED, BUT WISH THEY WERE | |
////////////////////////////////////////////////////////// | |
// Typically this is used to go up a directory. There is no command to | |
// go up a directory in Zed though. | |
// "-": "project_panel::GoUpOneDirectory", | |
// This is not a thing in Zed at the moment. If it was it would display | |
// the file preview in the current pane, but would keep the focus on the | |
// project panel. Moving off that previewed file would close the preview. | |
// "p": "project_panel::Preview" | |
} | |
}, | |
{ | |
"context": "Terminal", | |
"bindings": {} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment