diff --git a/include/zep/keymap.h b/include/zep/keymap.h index 6012fd0db..9a3626fee 100644 --- a/include/zep/keymap.h +++ b/include/zep/keymap.h @@ -142,6 +142,8 @@ DECLARE_COMMANDID(NextTabWindow) DECLARE_COMMANDID(StandardCopy) DECLARE_COMMANDID(StandardPaste) +DECLARE_COMMANDID(StandardSelectAll) + DECLARE_COMMANDID(MotionStandardDown) DECLARE_COMMANDID(MotionStandardUp) DECLARE_COMMANDID(MotionStandardLeft) diff --git a/src/mode.cpp b/src/mode.cpp index 39d83626e..3fd85ea88 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -974,6 +974,16 @@ bool ZepMode::GetCommand(CommandContext& context) GetCurrentWindow()->MoveCursorY(1, LineLocation::LineCRBegin); return true; } + else if (mappedCommand == id_StandardSelectAll) + { + context.commandResult.modeSwitch = EditorMode::Visual; + m_visualBegin = context.buffer.Begin(); + m_visualEnd = context.buffer.End(); + auto range = GetInclusiveVisualRange(); + GetCurrentWindow()->GetBuffer().SetSelection(range); + GetCurrentWindow()->SetBufferCursor(range.second); + return true; + } else if (mappedCommand == id_MotionStandardRightSelect) { context.commandResult.modeSwitch = EditorMode::Visual; diff --git a/src/mode_standard.cpp b/src/mode_standard.cpp index 77778db6c..568eb53a5 100644 --- a/src/mode_standard.cpp +++ b/src/mode_standard.cpp @@ -75,6 +75,8 @@ void ZepMode_Standard::Init() keymap_add({ &m_insertMap, &m_visualMap }, { "" }, id_StandardPaste); keymap_add({ &m_visualMap }, { "" }, id_StandardCopy); + keymap_add({ &m_insertMap, &m_visualMap }, { "" }, id_StandardSelectAll); + keymap_add({ &m_normalMap, &m_visualMap, &m_insertMap }, { "" }, id_InsertMode); keymap_add({ &m_normalMap }, { "" }, id_MotionStandardLeft); }