• Nibodhika@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    7 hours ago

    Absolutely, but you need to set plugins for that and it’s not easy to get to the same state, but once you’re there it’s easy to surpass it. Vim has a very steep learning curve, this applies to everything from moving around the text to plugin specific stuff, but once you learn it it’s much better than any alternative I’ve ever come across (and I’ve been programming for 20 years, only switched to Nvim recently, although I’ve known basic vim since forever).

    First let me tell you that I don’t know how to do all that you asked, some of it I’ve never needed, but I’m 100% sure it’s possible due to all of the other much more difficult stuff I have on my setup. The stuff that I do have, is much more convenient, e.g. with the cursor on a function/variable I can type gd (Go-to Declaration) to go to the declaration of it, or gr (Go-to References) to go to a list of references for that function/variable, that’s much more efficient than using a mouse, especially when it takes me at most 4 key presses to go to anywhere on the visible screen using jumps. So at the worst case scenario it takes me 6 keystrokes to go to the declaration of something I have on my screen, which even at 70WPM it means a bit over a second, whereas moving your hand to your mouse, mouse to the thingand Ctrl+click probably takes longer and is worse for the wrist.

    But it’s the things that you can only do on vim that make it worth it, really you might gain a few seconds here and there, which do accumulate but it’s the stuff that seems like magic, e.g. have you ever had to replace ' with " on a string because you wanted to write can't? <space>srq" that’s my shortcut for that, i.e. space to enter a “special mode” Surround Replace Quotes with " (srq"), and if I wanted to change from " to ' it would be <space>srq' so only the character I want to use change. Similarly I can do <leader>srb( to replace parantesis/brace/brackets with a parenthesis, heck I can even do <space>srq) to replace a quote with a parenthesis (notice I used open in the other and closed here? Open parenthesis means to add a space, closing one no space, same thing for brackets or braces). Another cool thing this plugin lets me do is ciq (Change Inside Quotes) to change all of the text inside the current/next quotes or dab (Delete Around Brackets) to delete everything inside the brackets and the brackets themselves. And all of that is just ONE plugin that extends the basic around/inside keywords in vim. There are dozens of plugins that completely revolutionize the way you move around and edit stuff. It’s hard to learn, but it’s incredibly rewarding.