Hi everyone :)

I’m slowly getting used on how to navigate and edit things in the terminal without leaving the keyboard and arrow keys. I’m getting faster and It improved my workflow in the terminal (Yeahhii).

ctrl + a e f b u k ...
alt + f b d ...

But yesterday I had such a bad experience while editing a backup bash script with nano. It took me like an hour to completely edit small changes like a caveman and always broke the editor when I used memory reflex terminal shortcuts.

This really pissed me… I know nano also has minimal/limited shortcuts but having to memorize and switch between different one for different purpose seems like a waste of time.

I think I tried emacs a few month ago but It didn’t clicked. I didn’t spend enough time though, tried it for a few minutes and deleted it afterwards. Maybe I should give it a second try?

I also gave Vim a try, but that session is still open and can’t exit (😂 )! Vim seems rather to complex for my workflow, I’m just a self-taught poweruser making his way through linux. Am I wrong?

Isn’t there something more “universal” ? That works everywhere I go the same? Something portable, so I can use it everywhere I go?

I’m very interested in everyone’s thought, insight, personal experience and tip/tricks to avoid what happened yesterday !

Thanks !

  • vort3@lemmy.ml
    link
    fedilink
    arrow-up
    22
    ·
    10 months ago

    Universal editor you are talking about is vim. Spend 15 minutes doing vimtutor and you’ll be happy 15 years later.

  • iusearchbtw@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    11
    ·
    10 months ago

    Seconding vim as the universal Unix/Linux editor. It takes a while to become a real vim pro, but learning basic usage is very helpful. Escape to switch to normal mode (where letters trigger functions instead of just typing), i to switch to input mode, : in normal mode to enter commands, :wq to save and quit, :q! to exit without saving - that alone should be enough to cover a lot of basic use cases. If you ever want to learn more, there are plenty of tutorials online.

  • tubbadu@lemmy.kde.social
    link
    fedilink
    arrow-up
    8
    ·
    10 months ago

    MICRO! It’s shortcuts are the same as any “gui” editor, so ctrl+S to save, ctrl+Q to quit, ctrl-C to copy etc, and also has an awesome mouse support (you don’t have to use the Mouse, but if sometimes you do, it works). It’s the first thing I install on new systems, give it a try ;)

    • N0x0n@lemmy.mlOP
      link
      fedilink
      arrow-up
      3
      ·
      10 months ago

      Heyy ! Thank you! I installed it right away and it seems exactly something I had in mind ! Plus point, it’s written in GO and their documentation seems on point !

      Do you think it makes sens to “sync” the shortcuts between micro and the terminal? I mean, changing ctrl+e and ctrl+a in micro to have the same behavior as in my bash terminal? Or does your brain just switch between them and you always now when to use what shortcut?

      Hope it makes sense and you somehow understand what I’m trying to achieve/explain.

      Thanks again !

  • pixelscript@lemmy.ml
    link
    fedilink
    English
    arrow-up
    5
    ·
    10 months ago

    I like VIM as a casual user.

    I barely know any of the fancy shortcuts, never successfully used a macro in my life, can’t remember how to open more than one edit buffer and have to look it up every single time, and I still constantly wrongfoot copy and paste regularly to the point where I consider it a waste of my time to try and I just type things out the long way. I totally get why people feel very defeated by this editor.

    But I do feel very slick darting around with hjkl, occasionally throwing in a gg or a G or a $ to leap around. Yeah, there are faster ways to get where I want if I’d only learn them, and I may some day, but this gets me around. If you can build up just the basic movements, that’s enough to at least begin to appreciate the editor.

    Not having to touch my mouse to edit text is a massive game changer that is worth it on its own. Not that vim is the only one that offers this benefit, of course. But what it does well that I haven’t experienced in editors I’ve tried is how beautifully it flows if you happen to already know how to touch-type. Y’know, hands on the homerow, certain fingers hit certain keys, building up the muscle memory so you don’t have to look at the keyboard to type, all that. It’s why vim uses hjkl to move the cursor–it’s where the right hand rests in a touch-typist position.

    If you don’t use keyboards this way, vim will probably ruin you. I know a lot of people who are proficient typists who never learned standard touch typing, instead home-rolling their own cursed setup that works for them, and god bless them, but they would be hard-pressed to negotiate vim. If this is you, vim may not be the editor for you.

    • N0x0n@lemmy.mlOP
      link
      fedilink
      arrow-up
      2
      ·
      10 months ago

      If you don’t use keyboards this way, vim will probably ruin you. I know a lot of people who are proficient typists who never learned standard touch typing, instead home-rolling their own cursed setup that works for them, and god bless them, but they would be hard-pressed to negotiate vim. If this is you, vim may not be the editor for you.

      Yeah so vim isn’t for me right now… Maybe in a unknown future where I find the motivation to learn the standard touch typing, but I have the feeling this add to much constrain and strange wrist movements (maybe i’m wrong ).

      Thanks your thoughtful input and personal experience !

      • Para_lyzed@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        10 months ago

        Proper touch typing is a dramatic increase to ergonomics and efficiency, and will reduce strain overall. Your wrists shouldn’t be moving much if at all while touch typing. There are lots of free online resources available for you to learn how to touch type quickly (and properly). When I first learned how to touch type after years of looking at my keyboard, I got from 0 to 30WPM in a few days of spending a couple hours each day. After a week, I had almost doubled my WPM before learning touch typing, at 60WPM. It’s a very important skill that you will be glad you learned if you have regular interactions with computers.

        But I understand that this is beyond the scope of your original post.

        As far as portability is concerned, you will find vi (the predecessor to vim) on basically any Linux system you will ever run across. It works consistently and is installed by default basically everywhere. I used to hate vim, but after taking the minimal amount of effort to learn neovim, creating my own keybinds, and installing plugins, I’ve come to absolutely love it. It just takes a small amount of time to wrap your head around switching between insert mode and command mode (i to enter insert mode, escape to leave insert mode back into command mode, :w to save in command mode, and :q to quit in command mode (can combine to save and quit with :wq)), but after that it becomes quite intuitive.

        You could even use a mouse with vim/neovim, though I would recommend keeping that usage to when you are scrolling through a large file quickly, looking for errors, etc. where you don’t need to be actively typing. You can even turn it into an IDE with the use of language servers that will find compilation errors in files, similar to what you can achieve in something like VS Code. The possibilities are endless. Yes, it has a steep learning curve if you want to get incredibly efficient with it, but you can pick up basic editing in vim very quickly.

      • pixelscript@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        10 months ago

        I can never reliably cut/copy and paste what I want in Vim. I’m always either picking up or leaving behind stray characters at the edges of my visual selection, because I find the end cursor so counterintuitive.

        Especially true when newlines are involved, it’s always a mystery how many newlines I’ll paste into my document when I hit p to put.

        This is not Vim’s fault, it’s just skill issue.

        Oh, and it’s also a mystery whether the system clipboard will work properly with Vim out of the box or not. There’s some voodoo setting you have to tweak if it doesn’t.

        • GiantRobotTRex@lemmy.sdf.org
          link
          fedilink
          arrow-up
          2
          ·
          10 months ago

          I see. Yeah, the end cursor can take some getting used to.

          The thing that always messed me up when starting out was how deleting any text overwrites the clipboard. It was an odd quirk at first but I kind of like it now.

          • pixelscript@lemmy.ml
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            10 months ago

            Yeah, the notion that “cut” and “delete” are the same operation was an interesting hurdle. It’s quite elegant, honestly.

            The only thing it disrupts is the situation where you want to copy something, delete a second thing, then paste the first thing. Oops! Too bad! It’s gone now!

            I’m aware we do have access to multiple registers in Vim, effectively giving us many clipboards to bypass this, but I don’t know the commands to utilize them. Without that knowledge, this little quirk remains an occasional irritation. Just not irritating enough to motivate me enough to knuckle down and learn it.

  • sin_free_for_00_days@sopuli.xyz
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    10 months ago

    I remember first using Vim a good 25+ years ago at this point. I hated it. Then I learned it. Now everything else just feels like shit.

    That said, try a bunch of different editors and see which one you like most. Try micro (you can probably just install it from your package manager), it might make you happy with your old Windows muscle memory.

  • The Doctor@beehaw.org
    link
    fedilink
    English
    arrow-up
    2
    ·
    10 months ago

    Every text editor has a learning curve. It looks like the terminal shortcuts you’ve been learning were bleeding over into nano. That’s not a nano problem, that’s just where you’re at on the learning curve right now. You probably would have made the same trip-ups in another text editor for the same reason. Even DOS’ EDIT.COM had a learning curve back in the day.

    I don’t want to get into a text editor flame war here. Suffice it to say that trying lots of different text editors is a good way to see what works and doesn’t work for you. If it helps, I used pico as my primary editor for a good fifteen years, until I forced myself to learn vi just because I wanted to branch out a little.

    I don’t think you have to learn every last little thing about a text editor, just what you normally do: Move the cursor around, enter text, delete text, search, replace. Don’t worry about learning everything, learn what you need as you need it.

    As for universal, I’m afraid that it’s probably going to be vi and its descendants. It’s been included in many UNIXes and UNIX-alikes for decades (it’s even built into busybox) for a reason: It’s small, lean, mean, and if you absolutely, positively have to rescue a broken box, it’s always there in /bin.

    • N0x0n@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      10 months ago

      Hiii !

      That’s not a nano problem, that’s just where you’re at on the learning curve right now. You probably would have made the same trip-ups in another text editor for the same reason.

      You’re right ! but I have to add that I found nano’s default shortcuts really “out-of-tune” and not intuitive at all (personal opinion). Sure I could have changed them to my liking, but that would cause portability issues I do not want to cope with !

      I don’t think you have to learn every last little thing about a text editor, just what you normally do: Move the cursor around, enter text, delete text, search, replace. Don’t worry about learning everything, learn what you need as you need it.

      👍

      As for universal, I’m afraid that it’s probably going to be vi and its descendants. It’s been included in many UNIXes and UNIX-alikes for decades (it’s even built into busybox) for a reason: It’s small, lean, mean, and if you absolutely, positively have to rescue a broken box, it’s always there in /bin.

      Ouch ! A lot of people actually tend to suggest that also, while I only tried vim once, I just uninstalled it after I had to google “how to exit vim” :| ! It was way to much of a hassle to just edit text :/. But as I read above, and as you said, just learning the basic stuff is enough to begin to like it and get comfortable.

      I’m uncertain which one I should stick with, someone suggested Micro, which seems really cool and more in sync on how I use the terminal at the moment. But there’s also the fact that vim is more universal and present everywhere, and even If you, as a long timer, switched to vi after 15 years, shouldn’t I just make the switch right now?


      One last technical question if you don’t mind, I already asked someone else but I’m interested in your long lasting technical expertise.

      Does It make sense to adapt/sync the keybinding shortcuts between the terminal and the text editor? Or do you know which one to use in every case scenario? Probably stupid, but that was probably my initial question with my Post, because I was sooo frustrated I couldn’t use the same shortcuts in nano… That’s what I was referring as “universal”, (wrong word choice :).

      Thank you for your inputs !!!

      • The Doctor@beehaw.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        9 months ago

        Ouch ! A lot of people actually tend to suggest that also, while I only tried vim once, I just uninstalled it after I had to google “how to exit vim” :| ! It was way to much of a hassle to just edit text :/. But as I read above, and as you said, just learning the basic stuff is enough to begin to like it and get comfortable.

        vi and vim take a little getting used to. There’s no shame in needing a cheatsheet; I used one when I was getting used to it (and the first time I had to use it in an emergency, I was looking up what I needed pretty much every minute). This looks like it might have something useful.

        Ultimately, what got me used to vi was using it every day to write blog entries (because, at the time, it was still hand-crafted HTML). I just had to use it a little every day.

        I think it would be helpful if you used vi a little bit to get used to how it feels. It couldn’t hurt to use Micro for a week, also, for the same reason. There’s no rush, there’s no deadline, give yourself a week of each to play around with them.

        As for updating the keybindings, I don’t think it’s a good idea, because the minute you find yourself on a system that doesn’t have them installed you’re back to square one. And, if you’re in the middle of fixing something you probably won’t have time to import them (and you may not even be able to, depending on what’s wrong).

        …doesn’t nano still have the menu bar at the bottom by default? I know pico (its predecessor) used to.

  • PlexSheep@feddit.de
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    10 months ago

    I open neovim at morning and close it at evening. It’s not so hard, my advice would be to do the vim tutor, built in.

    Open vim and type :Tutor and press enter.