Edit 4: I think I’ve fixed the issue. I uninstalled vim, deleted ~/.viminfo and /etc/vimrc, then reinstalled vim. I jumped around a file a bit, went in and out of edit mode, and type a bunch of ~ and it didn’t jump the text around at all. Still not sure what I did, but it appears this variation of turning it on and off again worked.

I’m hoping someone can help me with this.

I was holding my laptop while I had a vile open in vim, and I slipped, mashing a bunch of keys on the keyboard by mistake.

After doing this, I can’t type the ~ character anymore. Anytime I try to type it, it jumps the text to the last line, putting the last line at the top of the editing screen so that’s the only line of text showing.

I thought maybe I had set an option that would show up in ~/.vimrc, but there’s no ~/.vimrc file. There is a /etc/vimrc file, and a ~/.viminfo file.

I’ve searched and had no luck finding out what I did to cause this behavior. I also tried looking through the vim manpage and couldn’t find any info there either.

Edit 3: I just installed neovim and in neovim it acts as expected when I type the ~. Something I did notice is that in vim, I now have a blinking block cursor in insert mode as well as in visual mode, while in neovim, it’s a block cursor in visual mode and a vertical bar cursor in insert mode. I think this was the normal behavior in vim prior to whatever the heck I did.

Hoping someone knows what the heck I did. Thank you!

Edit: clarified what happens when I try to type ~

Edit 2: added details of the .vimrc and .viminfo files

  • unlawfulbooger@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    17 hours ago

    Try starting vim without config, I think that’s

    vim -u NONE
    

    Does it still occur then?

    If not, it’s a config issue in /etc/vimrc and/or ~/.vimrc (or maybe ~/.config/vim/vimrc or something?)

    If it does, it has to be something else.

    • harsh3466@lemmy.mlOP
      link
      fedilink
      arrow-up
      3
      ·
      16 hours ago

      I tried opening it without config and it acted even weirder, but that still helped me get towards my solution which is in the update in the post. Short of it is I uninstalled and removed .viminfo and /etc/vimrc then reinstalled

  • huf [he/him]@hexbear.net
    link
    fedilink
    English
    arrow-up
    4
    ·
    17 hours ago

    vim will load some other rc file if it cant find your ~/.vimrc. check what it has loaded with :scriptnames

    also, try starting vim in a brand new terminal with vim -u NONE and check if it’s still happening.

  • irotsoma@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    18 hours ago

    Did your keyboard mapping get changed? Try running this to check the current locale:

    localectl status

    Other settings are generally dependent on the distro you’re using.

    • harsh3466@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      18 hours ago

      I checked the locale and it is correct. I’m on Arch, and I just installed neovim to compare the cursor and typing behaviors, and in neovim it acts as expected when I type the ~.

      I did notice that in vim, I now have a blinking block cursor in insert mode as well as in visual mode, while in neovim, it’s a block cursor in visual mode and a vertical bar cursor in insert mode. This was the normal behavior in vim prior to whatever the heck I did.

      Edit: grammar

      • irotsoma@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        1
        ·
        16 hours ago

        Yeah, probably best bet is to uninstall and purge settings. Depending on the district you’re using and it’s package manager, you it may be as simple as apt purge vim. And just to be sure remove all vimrc files from all user home folders including root.

    • harsh3466@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      19 hours ago

      That’s what I thought too, but there’s no .vimrc. That was the first thing I checked. I should have included that.

      • catloaf@lemm.ee
        link
        fedilink
        English
        arrow-up
        3
        ·
        19 hours ago

        Hmm. Does it do it in other editors? My next guess is that it’s a laptop keyboard thing, like with the Fn key.

        I can’t imagine you completely remapped a key or created a shortcut just by mashing keys. I’m not even sure where that config would live.

        • harsh3466@lemmy.mlOP
          link
          fedilink
          arrow-up
          1
          ·
          18 hours ago

          I just installed neovim and in neovim it acts as expected when I type the ~. Something I did notice is that in vim, I now have a blinking block cursor in insert mode as well as in visual mode, while in neovim, it’s a block cursor in visual mode and a vertical bar cursor in insert mode. This was the normal behavior in vim prior to whatever the heck I did.