mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-10 14:06:11 +03:00
b0815bd13e
A complete overhaul of the way vim did paste. This ended up being more involved than I expected because of the variety of different behaviors that vim exhibits when copying/pasting between various modes. Release Notes: - vim: support P for paste before ([#1869](https://github.com/zed-industries/community/issues/1869)). - vim: support P in visual modes for paste without overriding clipboard - vim: fix position when using `p` on text copied outside zed ([#469](https://github.com/zed-industries/community/issues/469)). - vim: fix indentation when using `p` on text copied from zed ([#1015](https://github.com/zed-industries/community/issues/1015)). - all: Separate copied multi-selections by `\n`
466 lines
10 KiB
JSON
466 lines
10 KiB
JSON
[
|
|
{
|
|
"context": "Editor && VimControl && !VimWaiting && !menu",
|
|
"bindings": {
|
|
"i": [
|
|
"vim::PushOperator",
|
|
{
|
|
"Object": {
|
|
"around": false
|
|
}
|
|
}
|
|
],
|
|
"a": [
|
|
"vim::PushOperator",
|
|
{
|
|
"Object": {
|
|
"around": true
|
|
}
|
|
}
|
|
],
|
|
"h": "vim::Left",
|
|
"left": "vim::Left",
|
|
"backspace": "vim::Backspace",
|
|
"j": "vim::Down",
|
|
"down": "vim::Down",
|
|
"enter": "vim::NextLineStart",
|
|
"tab": "vim::Tab",
|
|
"shift-tab": "vim::Tab",
|
|
"k": "vim::Up",
|
|
"up": "vim::Up",
|
|
"l": "vim::Right",
|
|
"right": "vim::Right",
|
|
"$": "vim::EndOfLine",
|
|
"^": "vim::FirstNonWhitespace",
|
|
"shift-g": "vim::EndOfDocument",
|
|
"w": "vim::NextWordStart",
|
|
"{": "vim::StartOfParagraph",
|
|
"}": "vim::EndOfParagraph",
|
|
"shift-w": [
|
|
"vim::NextWordStart",
|
|
{
|
|
"ignorePunctuation": true
|
|
}
|
|
],
|
|
"e": "vim::NextWordEnd",
|
|
"shift-e": [
|
|
"vim::NextWordEnd",
|
|
{
|
|
"ignorePunctuation": true
|
|
}
|
|
],
|
|
"b": "vim::PreviousWordStart",
|
|
"shift-b": [
|
|
"vim::PreviousWordStart",
|
|
{
|
|
"ignorePunctuation": true
|
|
}
|
|
],
|
|
"n": "search::SelectNextMatch",
|
|
"shift-n": "search::SelectPrevMatch",
|
|
"%": "vim::Matching",
|
|
"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
|
|
}
|
|
}
|
|
],
|
|
"ctrl-o": "pane::GoBack",
|
|
"ctrl-]": "editor::GoToDefinition",
|
|
"escape": [
|
|
"vim::SwitchMode",
|
|
"Normal"
|
|
],
|
|
"ctrl+[": [
|
|
"vim::SwitchMode",
|
|
"Normal"
|
|
],
|
|
"v": "vim::ToggleVisual",
|
|
"shift-v": "vim::ToggleVisualLine",
|
|
"ctrl-v": "vim::ToggleVisualBlock",
|
|
"ctrl-q": "vim::ToggleVisualBlock",
|
|
"*": "vim::MoveToNext",
|
|
"#": "vim::MoveToPrev",
|
|
"0": "vim::StartOfLine", // When no number operator present, use start of line motion
|
|
"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 h": "editor::Hover",
|
|
"g t": "pane::ActivateNextItem",
|
|
"g shift-t": "pane::ActivatePrevItem",
|
|
"g d": "editor::GoToDefinition",
|
|
"g shift-d": "editor::GoToTypeDefinition",
|
|
"g .": "editor::ToggleCodeActions", // zed specific
|
|
"g shift-a": "editor::FindAllReferences", // zed specific
|
|
"g *": [
|
|
"vim::MoveToNext",
|
|
{
|
|
"partialWord": true
|
|
}
|
|
],
|
|
"g #": [
|
|
"vim::MoveToPrev",
|
|
{
|
|
"partialWord": true
|
|
}
|
|
],
|
|
// z commands
|
|
"z t": "editor::ScrollCursorTop",
|
|
"z z": "editor::ScrollCursorCenter",
|
|
"z b": "editor::ScrollCursorBottom",
|
|
// 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
|
|
],
|
|
// window related commands (ctrl-w X)
|
|
"ctrl-w left": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Left"
|
|
],
|
|
"ctrl-w right": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Right"
|
|
],
|
|
"ctrl-w up": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Up"
|
|
],
|
|
"ctrl-w down": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Down"
|
|
],
|
|
"ctrl-w h": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Left"
|
|
],
|
|
"ctrl-w l": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Right"
|
|
],
|
|
"ctrl-w k": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Up"
|
|
],
|
|
"ctrl-w j": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Down"
|
|
],
|
|
"ctrl-w ctrl-h": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Left"
|
|
],
|
|
"ctrl-w ctrl-l": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Right"
|
|
],
|
|
"ctrl-w ctrl-k": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Up"
|
|
],
|
|
"ctrl-w ctrl-j": [
|
|
"workspace::ActivatePaneInDirection",
|
|
"Down"
|
|
],
|
|
"ctrl-w g t": "pane::ActivateNextItem",
|
|
"ctrl-w ctrl-g t": "pane::ActivateNextItem",
|
|
"ctrl-w g shift-t": "pane::ActivatePrevItem",
|
|
"ctrl-w ctrl-g shift-t": "pane::ActivatePrevItem",
|
|
"ctrl-w w": "workspace::ActivateNextPane",
|
|
"ctrl-w ctrl-w": "workspace::ActivateNextPane",
|
|
"ctrl-w p": "workspace::ActivatePreviousPane",
|
|
"ctrl-w ctrl-p": "workspace::ActivatePreviousPane",
|
|
"ctrl-w shift-w": "workspace::ActivatePreviousPane",
|
|
"ctrl-w ctrl-shift-w": "workspace::ActivatePreviousPane",
|
|
"ctrl-w v": "pane::SplitLeft",
|
|
"ctrl-w ctrl-v": "pane::SplitLeft",
|
|
"ctrl-w s": "pane::SplitUp",
|
|
"ctrl-w shift-s": "pane::SplitUp",
|
|
"ctrl-w ctrl-s": "pane::SplitUp",
|
|
"ctrl-w c": "pane::CloseAllItems",
|
|
"ctrl-w ctrl-c": "pane::CloseAllItems",
|
|
"ctrl-w q": "pane::CloseAllItems",
|
|
"ctrl-w ctrl-q": "pane::CloseAllItems"
|
|
}
|
|
},
|
|
{
|
|
// escape is in its own section so that it cancels a pending count.
|
|
"context": "Editor && vim_mode == normal && vim_operator == none && !VimWaiting",
|
|
"bindings": {
|
|
"escape": "editor::Cancel",
|
|
"ctrl+[": "editor::Cancel"
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
|
|
"bindings": {
|
|
"c": [
|
|
"vim::PushOperator",
|
|
"Change"
|
|
],
|
|
"shift-c": "vim::ChangeToEndOfLine",
|
|
"d": [
|
|
"vim::PushOperator",
|
|
"Delete"
|
|
],
|
|
"shift-d": "vim::DeleteToEndOfLine",
|
|
"shift-j": "editor::JoinLines",
|
|
"y": [
|
|
"vim::PushOperator",
|
|
"Yank"
|
|
],
|
|
"i": [
|
|
"vim::SwitchMode",
|
|
"Insert"
|
|
],
|
|
"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",
|
|
"p": "vim::Paste",
|
|
"shift-p": [
|
|
"vim::Paste",
|
|
{
|
|
"before": true
|
|
}
|
|
],
|
|
"u": "editor::Undo",
|
|
"ctrl-r": "editor::Redo",
|
|
"/": "vim::Search",
|
|
"?": [
|
|
"vim::Search",
|
|
{
|
|
"backwards": true
|
|
}
|
|
],
|
|
";": "vim::RepeatFind",
|
|
",": [
|
|
"vim::RepeatFind",
|
|
{
|
|
"backwards": true
|
|
}
|
|
],
|
|
"r": [
|
|
"vim::PushOperator",
|
|
"Replace"
|
|
],
|
|
"s": "vim::Substitute",
|
|
"> >": "editor::Indent",
|
|
"< <": "editor::Outdent",
|
|
"ctrl-pagedown": "pane::ActivateNextItem",
|
|
"ctrl-pageup": "pane::ActivatePrevItem"
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && vim_operator == n",
|
|
"bindings": {
|
|
"0": [
|
|
"vim::Number",
|
|
0
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && vim_operator == c",
|
|
"bindings": {
|
|
"c": "vim::CurrentLine",
|
|
"d": "editor::Rename" // zed specific
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && vim_operator == d",
|
|
"bindings": {
|
|
"d": "vim::CurrentLine"
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && vim_operator == y",
|
|
"bindings": {
|
|
"y": "vim::CurrentLine"
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && VimObject",
|
|
"bindings": {
|
|
"w": "vim::Word",
|
|
"shift-w": [
|
|
"vim::Word",
|
|
{
|
|
"ignorePunctuation": true
|
|
}
|
|
],
|
|
"s": "vim::Sentence",
|
|
"'": "vim::Quotes",
|
|
"`": "vim::BackQuotes",
|
|
"\"": "vim::DoubleQuotes",
|
|
"(": "vim::Parentheses",
|
|
")": "vim::Parentheses",
|
|
"[": "vim::SquareBrackets",
|
|
"]": "vim::SquareBrackets",
|
|
"{": "vim::CurlyBrackets",
|
|
"}": "vim::CurlyBrackets",
|
|
"<": "vim::AngleBrackets",
|
|
">": "vim::AngleBrackets"
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && vim_mode == visual && !VimWaiting && !VimObject",
|
|
"bindings": {
|
|
"u": "editor::Undo",
|
|
"o": "vim::OtherEnd",
|
|
"shift-o": "vim::OtherEnd",
|
|
"d": "vim::VisualDelete",
|
|
"x": "vim::VisualDelete",
|
|
"y": "vim::VisualYank",
|
|
"p": "vim::Paste",
|
|
"shift-p": [
|
|
"vim::Paste",
|
|
{
|
|
"preserveClipboard": true
|
|
}
|
|
],
|
|
"s": "vim::Substitute",
|
|
"c": "vim::Substitute",
|
|
"~": "vim::ChangeCase",
|
|
"shift-i": [
|
|
"vim::SwitchMode",
|
|
"Insert"
|
|
],
|
|
"shift-a": "vim::InsertAfter",
|
|
"r": [
|
|
"vim::PushOperator",
|
|
"Replace"
|
|
],
|
|
"ctrl-c": [
|
|
"vim::SwitchMode",
|
|
"Normal"
|
|
],
|
|
"escape": [
|
|
"vim::SwitchMode",
|
|
"Normal"
|
|
],
|
|
"ctrl+[": [
|
|
"vim::SwitchMode",
|
|
"Normal"
|
|
],
|
|
">": "editor::Indent",
|
|
"<": "editor::Outdent",
|
|
"i": [
|
|
"vim::PushOperator",
|
|
{
|
|
"Object": {
|
|
"around": false
|
|
}
|
|
}
|
|
],
|
|
"a": [
|
|
"vim::PushOperator",
|
|
{
|
|
"Object": {
|
|
"around": true
|
|
}
|
|
}
|
|
],
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && vim_mode == insert && !menu",
|
|
"bindings": {
|
|
"escape": "vim::NormalBefore",
|
|
"ctrl-c": "vim::NormalBefore",
|
|
"ctrl-[": "vim::NormalBefore"
|
|
}
|
|
},
|
|
{
|
|
"context": "Editor && VimWaiting",
|
|
"bindings": {
|
|
"tab": "vim::Tab",
|
|
"enter": "vim::Enter",
|
|
"escape": [
|
|
"vim::SwitchMode",
|
|
"Normal"
|
|
],
|
|
"ctrl+[": [
|
|
"vim::SwitchMode",
|
|
"Normal"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"context": "BufferSearchBar > VimEnabled",
|
|
"bindings": {
|
|
"enter": "vim::SearchSubmit",
|
|
"escape": "buffer_search::Dismiss"
|
|
}
|
|
}
|
|
]
|