vim: Revert 'Y' to yank to end of line (#17563)

Vishal Bhavsar created

Closes https://github.com/zed-industries/zed/issues/17549

Change summary

assets/keymaps/vim.json                |  2 +-
crates/vim/src/normal.rs               | 23 -----------------------
crates/vim/test_data/test_shift_y.json |  4 ----
3 files changed, 1 insertion(+), 28 deletions(-)

Detailed changes

assets/keymaps/vim.json 🔗

@@ -214,7 +214,7 @@
       "shift-d": "vim::DeleteToEndOfLine",
       "shift-j": "vim::JoinLines",
       "y": ["vim::PushOperator", "Yank"],
-      "shift-y": "vim::YankToEndOfLine",
+      "shift-y": "vim::YankLine",
       "i": "vim::InsertBefore",
       "shift-i": "vim::InsertFirstNonWhitespace",
       "a": "vim::InsertAfter",

crates/vim/src/normal.rs 🔗

@@ -52,7 +52,6 @@ actions!(
         DeleteToEndOfLine,
         Yank,
         YankLine,
-        YankToEndOfLine,
         ChangeCase,
         ConvertToUpperCase,
         ConvertToLowerCase,
@@ -77,7 +76,6 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut ViewContext<Vim>) {
     Vim::action(editor, cx, Vim::convert_to_upper_case);
     Vim::action(editor, cx, Vim::convert_to_lower_case);
     Vim::action(editor, cx, Vim::yank_line);
-    Vim::action(editor, cx, Vim::yank_to_end_of_line);
     Vim::action(editor, cx, Vim::toggle_comments);
     Vim::action(editor, cx, Vim::paste);
 
@@ -428,18 +426,6 @@ impl Vim {
         self.yank_motion(motion::Motion::CurrentLine, count, cx)
     }
 
-    fn yank_to_end_of_line(&mut self, _: &YankToEndOfLine, cx: &mut ViewContext<Self>) {
-        self.record_current_action(cx);
-        let count = self.take_count(cx);
-        self.yank_motion(
-            motion::Motion::EndOfLine {
-                display_lines: false,
-            },
-            count,
-            cx,
-        )
-    }
-
     fn toggle_comments(&mut self, _: &ToggleComments, cx: &mut ViewContext<Self>) {
         self.record_current_action(cx);
         self.update_editor(cx, |_, editor, cx| {
@@ -1408,15 +1394,6 @@ mod test {
         );
     }
 
-    #[gpui::test]
-    async fn test_shift_y(cx: &mut gpui::TestAppContext) {
-        let mut cx = NeovimBackedTestContext::new(cx).await;
-
-        cx.set_shared_state("helˇlo\n").await;
-        cx.simulate_shared_keystrokes("shift-y").await;
-        cx.shared_clipboard().await.assert_eq("lo");
-    }
-
     #[gpui::test]
     async fn test_r(cx: &mut gpui::TestAppContext) {
         let mut cx = NeovimBackedTestContext::new(cx).await;