this post was submitted on 02 Sep 2024
802 points (93.6% liked)

Linux

48081 readers
796 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] GustavoM@lemmy.world 7 points 2 months ago (4 children)

Nano is my "daily drive", but I'd use vim as well -- takes a couple seconds to search for "how to type in linux vim" and "how to save a file in linux vim" anyways. :^)

[–] Rekhyt@lemmy.world 7 points 2 months ago (3 children)

I know i and :wq and that's all I ever plan on learning

[–] theshatterstone54@feddit.uk 1 points 2 months ago (2 children)

Not even Basic Command-Count-motion like c3w aka change 3 words after cursor, or d3b delete 3 words before the cursor?

To that, you add the D aka delete command C for change Y for yank (copy)

So yy to yank line, or dd to delete line.

Also p for paste

Also, i sends you before the cursor, a sends you after. Capital I is insert at beginning of line, Capital A is insert at end of line (append).

I terms of motions and moving around, you need: hjkl, C-d and C-u (half page jumps down and up), and within the line: 0 or ^ for beginning of line, $ for end (taken from regex), w for moving by word forwards, b for moving by word backwards. That's pretty much all you need imo. There is also t and f. Where t goes forwards (think 'till aka until). Like dtc delete until the c character. F is the same but goes backwards in the line rather than forwards. Remember you can use these with xommands, so d$ deletes until the end of the line. Or "dt." deletes till the "." so.... yeahI know there's more, but that's all you need for Normal and Insert mode imo.

For Visual mode, you only need to know how the Visual modes work. Visual (v), Visual Line (Shift-v) and Visual Block (Ctrl-V).

Also, for visual mode, it might be helpful to learn how to use V-Block to comment out multiple lines at once. Can't be bothered to go into it.

But I'd argue that's all there is to learn about vim keys in terms of getting work done.

[–] Rekhyt@lemmy.world 2 points 2 months ago* (last edited 2 months ago) (1 children)

Not gonna lie, once you're getting past single button combos, I'm mentally checking out. Ctrl+K and Ctrl+U in nano are good enough for me, and if I need to do something more complex like actual coding, I'll use an editor with a full GUI as well.

[–] theshatterstone54@feddit.uk 2 points 2 months ago

Fair enough. I basically gave you a large chunk of vim so it will feel super overwhelming. The trick is to do one command or combo at a time. For example, I started with dd. Then I added yanking. Then I added visual mode. Then I added "o" (which I think I forgot to mention: o creates a newline under the current one and puts you in insert mode. Capital O does the same but above the current line). The real trick is going little by little. And to be honest, there are some commands I still rarely use or forget to mention. I've never used f instead of t. And in terms of forgetting to mention, there's the x command which deletes the single character under the cursor rn.

Also, I'm sure someone will find this list helpful, so on top of this, I'll also add this video (and hope that Piped bot will appear): https://www.youtube.com/watch?v=RSlrxE21l_k

It contains some things I haven't mentioned.

As for learning all this, I'm repeating myself for the third time. Do it little by little. And when a command is already a thing you do almost without thinking about it, you're ready to add more.

I'm mentally checking out

Why? dw is delete word, c5b change 5 words backwards, and those are the most complicated commands you'll ever get to use, unless you start adding cuatom keybinds.

But I digress. If you don't want to learn it, it's fine.