I’d like actual examples instead of “I work faster”, something like “I can move straight to the middle of the file with 7mv” or “I can keep 4 different text snippets in memory and paste each with a number+pt, like 2pt”, things that you actually use somewhat frequently instead of what you can do, but probably only did once.

  • Balinares@pawb.social
    link
    fedilink
    arrow-up
    31
    ·
    5 months ago

    Where editors usually have editing shortcuts, vim has an editing grammar.

    So you can copy (or select, or replace, or delete, or any other editing verb) N arguments or blocks or lines or functions or any entity for which vim has an editing noun, or around or inside either of these, and you only need to remember a few such editing verbs and nouns and adjectives in order to immediately become much more effective.

    It’s so effective that switching back to a regular editor feels annoyingly clunky. (I guess that’s why many offer vim plugins these days.)

    Better: you can record entire editing sentences and replay them. Ever had to make the same change on dozens of lines? Now you can do it in seconds.

    Now of course, replaying a sentence, or several sentences, is also a sentence of its own that you can replay in another file if you want.

    It’s neat. :)

    • I Cast Fist@programming.devOP
      link
      fedilink
      arrow-up
      7
      ·
      5 months ago

      Better: you can record entire editing sentences and replay them. Ever had to make the same change on dozens of lines? Now you can do it in seconds.

      I think my first experience with that kind of macro recording/replay was with Dwarf Fortress, of all things.

        • I Cast Fist@programming.devOP
          link
          fedilink
          arrow-up
          3
          ·
          5 months ago

          CTRL R starts recording the inputs, press again to stop. CTRL P plays it. Makes digging magma shafts through several floors, then setting up the pumps, so much easier

          • Kalothar@lemmy.ca
            link
            fedilink
            arrow-up
            1
            ·
            5 months ago

            I didn’t know this and tried to record on my keyboard a macro, and DF blocked me when I tried to use my keyboards built in macro keys. I guess that makes sense.

    • zipsglacier@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      5 months ago

      This is the comment that best explains it for me. I started with vim for comfort (less movement to mouse, and less reliance on modifier keys). The editing grammar is something I didn’t really understand until I started gradually using it, but now it’s the thing I most appreciate. I don’t know if I’m necessarily faster in vim, but my work is more fluid. The editing doesn’t interrupt my thinking as much.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      3
      arrow-down
      2
      ·
      5 months ago

      Ever had to make the same change on dozens of lines? Now you can do it in seconds.

      This would be a big advantage… except multiple cursors were invented so I can easily do that without having to memorize a whole new editing language.

      • Balinares@pawb.social
        link
        fedilink
        arrow-up
        7
        ·
        5 months ago

        Multiple cursors are fantastic for certain use cases, but will not help you when each line needs a different input – if you’re swapping arguments in function calls, if you’re replacing one bracket type with another around contents of arbitrary length, etc.

        Mind you, if your objective here is to not learn a new thing, then you can just go ahead and do that, you don’t need an excuse.

        • lad@programming.dev
          link
          fedilink
          English
          arrow-up
          3
          ·
          5 months ago

          Yeah, I usually do that with regexp replacement in other editors, but sometimes it’s too hard to express as a regular expression

      • zagaberoo@beehaw.org
        link
        fedilink
        arrow-up
        2
        ·
        5 months ago

        That’s just one thing the editing language does, though. There’s no single feature you can point to as the smoking gun; it’s all the small advantages added together that make vi worthwhile.