0

I'm running Neovim 0.5.0 locally. I'm going through Harvard's CS50 course and they have an IDE (accessible here: https://ide.cs50.io/) with a shell that's running this version of Vim:

     version 8.1.2269                                                                           
    by Bram Moolenaar et al.                                                                       
   Modified by team+vim@tracker.debian.org                                                               
Vim is open source and freely distributable

I can also access a version of vim 7.4 through a computing cluster of a different university. Have tested what I'm about to demonstrate using empty vimrcs.

In the version of Vim in the CS50 shell's IDE if I start with my cursor on the space between LINE and ONE on the first line here:

LINE ONE
line two

and in normal mode type dj the resulting text is

LINE two

having deleted the words ONE and line.

When I do the same thing in the other versions I mentioned it deletes both lines of text completely as if I had typed 2dd. Have tested it for dk as well.

Also, if I remember correctly (though I'm not going to check now) the behavior from the CS50 IDE is also what occurs in the educational game Vim Adventures.

So my question is why is there this inconsistent behavior? Was it just that particular version of Vim in the CS50 IDE shell? Was it the modifications that the Debian team did to the CS50 version of VIM? Maybe there is a setting I can set? Maybe it has something to do with the more specific vim configuration of one of the options when I type vim --version in the CS50 IDE? (omitted that info here for for brevity; can add if relevant).

0
1

The expected behavior of dj in Vim is to delete the current and the next line. The behavior you observe in your IDE is equivalent to dvj, as described by :h forced-motion:

Example:
dj
deletes two lines
dvj
deletes from the cursor position until the character below the cursor.

So if the behavior is different in the IDE it's because either they modified the source code or because it somehow includes a map djdvj. Try to start your IDE Vim with --clean to confirm or refute it.

2
  • Ok, --clean fixed it. There must be a system-wide vimrc that I don't have access to. Jul 6 at 22:59
  • @JordanMandel check :scriptnames
    – D. Ben Knoble
    Jul 7 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.