• [object Object]@lemmy.ca
      link
      fedilink
      arrow-up
      73
      ·
      2 days ago

      If it’s a read only file it won’t work, but it might be in insert mode and can’t escape.

      It should have tried :q!

    • eli@lemmy.world
      link
      fedilink
      arrow-up
      9
      ·
      2 days ago

      Could be in recording mode, which usually needs a couple ESC or a Q then you can :wq

      • Miaou@jlai.lu
        link
        fedilink
        arrow-up
        1
        ·
        2 days ago

        You mean EX mode? IIRC recording mode doesn’t prevent exiting vim

        • eli@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          2 days ago

          Ah just looked up EX mode. Didn’t know capital Q entered a different mode, I just wrote “Q” to emphasize the key in general not capital Q specifically lol.

          Personally I love vim, it’s just powerful enough for me for my bash scripts. Anything more complicated then I’m using a proper IDE or something more simple I’m using Kate or whatever graphical editor for my DE.

        • eli@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          2 days ago

          Nah, just looked it up. Recording mode is activated by pressing “q” and allows you to record your inputs for a macro. So if you forget to do “:” and just press “q” you’ll enter Recording mode and have to press “q” again to exit Recording and then you can do “:q” or whatever you needed.

          But if you don’t know what you pressed and don’t know how to exit Recording mode then you’ll be stuck. I’ve seen coworkers get stuck in this from time to time.

          We’re a RHEL shop so our vim version may be different, but Recording mode doesn’t let us exit vim directly, we have to exit Recording mode and then exit vim. Again, might just be our setup.