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.

  • borf@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    4 months ago

    Just being able to jump to the top of the file, bottom of the file, beginning or end of the line, or directly to a regex pattern match or particular character already gives me some of the same satisfaction as a video game with really tight movement controls. (I also like being able to jump to lines by number, manipulate lines by number or range, and I like being able to get to the top, bottom, or middle of the screen with one or two keypresses.)

    In the same vein, deleting arbitrary lines at a time, performing external operations only on lines that match a particular pattern, and saving macro recordings of repetitive manual changes all feel like multiplicative powerups. Heck, incrementing and decrementing with ^a and ^x feels like one more little cheat code. Bouncing on parentheses with % makes structured files easy to get around in.

    These are all things I’ve done with some regularity over the years.

    • I Cast FistOP
      link
      fedilink
      arrow-up
      6
      ·
      4 months ago

      Bouncing on parentheses with % makes structured files easy to get around in.

      That’s something I wasn’t aware you could do in vim. % jumps to the next parentheses character, whether ( or )? Does it work with brackets and curly braces too?

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

        Not just the next parenthesis that appears, It jumps to the matching one that opens or closes the one under the cursor. Hitting it repeatedly bounces back and forth around the text that pair of parentheses enclose.

        It works not only with brackets and curly braces, but also with opening and closing tags in XML etc.

        I feel like other editors must have an equivalent feature, though. I’d say the fact that vi can put such a specific action under just % rather than some nasty chord or mouse operation is what really makes it shine here.

      • expr
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        It generally works with a wide variety of delimiters. There’s a widely used plugin to make it work with even more, including language-specific keyword pairs.