this post was submitted on 11 Jul 2024
54 points (95.0% liked)

Linux

48328 readers
602 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
 

I wanted to have a separate laptop where I only use the terminal for my use cases. At the moment I am somewhat confident using the terminal, but I think limiting myself to tty only would build my confidence even more. Any tips?

EDIT: I am already using nvim and I already have installed a minimal distro (Arch). I just need advice on how to actually run this system effectively.

you are viewing a single comment's thread
view the rest of the comments
[–] GravitySpoiled@lemmy.ml 6 points 4 months ago* (last edited 4 months ago) (7 children)

How can you be more productive in vim compared to nano?

Serious question.

[–] mryessir@lemmy.sdf.org 11 points 4 months ago (1 children)

vim is more then simple file editing.

  • netrw (interactive file manager)
  • copen/lopen (windows to connect, e.g. external programs)
  • :global, %s/, etc. which form text manipulation language (from editor ed, I guess)
  • args & argsdo (multi-file editing)
  • filetype (hooks for the user)
  • ctrl_X completion modes
  • motion (fluent & with jumplist to walk forward/backwardl
  • undotree (persisting, unlimited, timebased - on-demand)
  • macros (record and replay keypress)
  • romainl (awesome community member)

vim for one-time tasks at work. When people are proposing to script something, I open buffers, normalize the data and filter the results. I think in vim and I would very, very much recommend it, if you work with data or are a dev.

[–] GravitySpoiled@lemmy.ml 4 points 4 months ago

you guys convinced me. I check vim out for at least the weekend

[–] chameleon@fedia.io 5 points 4 months ago (2 children)

vim has better default keybindings/commands that allow for less movement of your hands. Nowadays, in reasonably current versions of nano, that's mostly it. The main difference is nano is somewhat usable but extremely inefficient unless you learn it, while vim forces you to learn it to get anything done at all, which also pushes people to spend a bit of time learning it in general.

If you're sure of the numbers you're using, vim's ability to repeat commands is also helpful. In practice I find that it's really hard to make use of them beyond low numbers, where nano can still achieve things in similar amounts of keypresses. Eg something to delete 3 words like <escape>3dwi can be done similar with a sequence like Alt-A ^→ ^→ ^→ ^K in nano. Make it 20 words and nano is going to be a lot slower, but that's quite an uncommon action.

But the practice is that nano users don't spend time learning any of that and just hold delete until the words are gone, which takes forever. Everyone that can do basics in vim quickly learns that you can dw words away and make it 3dw to delete 3 of them. The default, easiest to use & access tool for any given situation gets blamed not just for its flaws, but also for the users that don't want to spend time learning any tool.

[–] GravitySpoiled@lemmy.ml 3 points 4 months ago* (last edited 4 months ago) (1 children)

After reading up on vim, I ended up at emacs now and I like the emacs style because it works with ctrl and meta keys which feels familar to me. I may learn emacs now.

Your example makes completely sense, yet I've never felt that the standard way was slow in the first place. I could see my workflow improving, but I guess I just want to have extra special commands. Thank you!

[–] sem@lemmy.blahaj.zone 1 points 4 months ago

I agree that vim forces you to learn before you can use it, but it is possible to learn the bare minimum of vim.

I get by with a very basic understanding of insert mode and the other mode where :q! quits

[–] h0bbl3s@lemmy.world 4 points 4 months ago (1 children)

VIM for the win. I really enjoy the built in file browser accessed by the command :explore

I also code in go frequently and go-fmt and go-lint etc work flawlessly. You can use whatever LSP you want so you get your code tips and autosuggestion etc.

The tabs and split window functions are nice too. Plus if you learn Vi well it's on almost every system in existence. Nano not so much

[–] GravitySpoiled@lemmy.ml 2 points 4 months ago

I had my first training sessions and edited some prose. I'm excited how it'll be with code.

[–] NeoNachtwaechter@lemmy.world 3 points 4 months ago (1 children)

Easy. Just learn to use it and it is already there.

With nano, you work with that letter where your cursor is at the moment. This is convenient, but limited.

With vim, you can also work with a word, or the whole line, or part of the line, or a section, or the whole file (or many files if you use the shell extension) and it goes all with the same ease.

Vim also allows you to keep your hands in place on the letters on your keyboard all the time. No need to move the hands around, grabbing the mouse and back, or the arrow keys, and thus search for the correct position for your hand every few seconds - which costs time and focus.

[–] GravitySpoiled@lemmy.ml 1 points 4 months ago (2 children)

If I understand you correctly, I can write more efficiently because I can move to the next paragraph or sentence which I can't with normal keybindings. Or special commands where I delete everything within "". I understand the appeal of special moves but why not simply creating a Ctrl, Meta or alt command for that?

[–] CsXGF8uzUAOh6fqV@lemmy.world 3 points 4 months ago

Vim uses these commands like di" (delete everything inside "") instead of chords (holding multiple keys down at once). Both work fine. The reason vim does this is that many regard it as more ergonomic. You don't stretch your hand/fingers out and you can keep your fingers at homerow. You might have heard about people getting an "Emacs Pinky". It's basically down to preference. I don't use emacs but I know people use vim bindings in emacs (emacs is very scriptable after all). That way you can try or integrate vim like bindings without leaving your comfy emacs.

[–] NeoNachtwaechter@lemmy.world 0 points 4 months ago* (last edited 4 months ago) (1 children)

but why not simply creating a Ctrl, Meta or alt command for that?

No need to create such things when they are already there

I find Ctrl etc. rather inefficient. So much extra bending of your hand for these special keys. Are you able to type with 10 fingers?

[–] GravitySpoiled@lemmy.ml 2 points 4 months ago

I learned it but I only use 7 or 8 fingers. The speed isn't limiting me.

[–] GolfNovemberUniform@lemmy.ml 2 points 4 months ago* (last edited 4 months ago)

Tbh I think it's just a matter of preference and some people are being elitist about it or overestimate the importance of it.

[–] F04118F@feddit.nl 2 points 4 months ago* (last edited 4 months ago) (1 children)

Try running this: vimtutor

If you are already aware of hjkl, skip to the part where you learn motions:

/motion

Then look up surround (ysw is usually the command to surround a word, ys3w the next 3 words, etc)

It's pretty neat.

[–] GravitySpoiled@lemmy.ml 2 points 4 months ago* (last edited 4 months ago) (1 children)

That is some very useful commands, thx! But I don't think I'll be using it often and hence I'll lose the skill. I know ctrl+vxs or f etc because I use them very often. Anything that I don't use is forgotten even if I'd use vim

[–] F04118F@feddit.nl 3 points 4 months ago (1 children)

Exactly! If you only have to edit small text files on a server once in a blue moon, nano is much less biomemory-heavy. But if you regularly write docs and code in l vim or neovim, it starts to pay off after a week or two.

I really enjoyed learning to quickly select and change entire words or lines, doing things like: :%s/replace_this_text/with_that/g Etc. If you enjoy that, you will soon get to a point where you miss the motions in your regular editor and install a vim extension in VS Code and stuff, just before fully switching to neovim

[–] GravitySpoiled@lemmy.ml 2 points 4 months ago

Thx! I'll check out neovim!

[–] SnotFlickerman@lemmy.blahaj.zone 1 points 4 months ago

why use big app when nano does trick?