this post was submitted on 25 Dec 2023
600 points (100.0% liked)

196

17864 readers
318 users here now

Be sure to follow the rule before you head out.


Rule: You must post before you leave.



Other rules

Behavior rules:

Posting rules:

NSFW: NSFW content is permitted but it must be tagged and have content warnings. Anything that doesn't adhere to this will be removed. Content warnings should be added like: [penis], [explicit description of sex]. Non-sexualized breasts of any gender are not considered inappropriate and therefore do not need to be blurred/tagged.

If you have any questions, feel free to contact us on our matrix channel or email.

Other 196's:

founded 2 years ago
MODERATORS
 

First time when you ssh into your Linux terminal and you gotta “sudo crontab -e” or something and it’s like “what editor do you want to use?” and nano sounds lame so you choose vim cause the sound is cool when you say it and then you have to wipe the whole comp and start over

top 39 comments
sorted by: hot top controversial new old
[–] AVincentInSpace@pawb.social 42 points 2 years ago* (last edited 2 years ago) (5 children)

How do I exit Vim?

escape colon w q

One of life's great mysteries

escape colon w q

I'm pretty sure it's impossible

it is literally. the first result on google.

The best way is to change to another terminal and forcequit it from there

escape then Shift+Z twice also works. or shift+Z shift+Q to quit without saving.

Or hard restart your entire computer

Are you people allergic to search engines or someth--

Bill Joy made vi impossible to exit because he wanted the source to always be open

siiiiiiiiigh

Yes, I'm an old man yelling at cloud, but Vim and Neovim are fantastic text editors that really are worth the half hour you'll spend running through the tutorial to learn them, and the subsequent two weeks you'll spend installing plugins and configuring it exactly to your liking. It really does make writing software more efficient and really doesn't deserve the reputation it gets from "vim is hard to exit lmao" memes made by people who haven't bothered to change their $EDITOR to nano, had it launch automatically when they tried to write a commit message, and instantly decided it was just yet another piece of arcane 80s Unix bullshit

[–] commandar@lemmy.world 19 points 2 years ago (1 children)

vi isn't a text editor as much as it's a text manipulation language.

It has a syntax, grammar, idioms, and, yes, a learning curve.

But once you learn it, it's as close to a brain-computer interface as I've experienced. You start thinking about edits as chainable operations and it literally becomes muscle memory -- if you ask someone experienced with vi how they just did a complex sequence of edits, chances are they'll have to stop and consciously walk through it because they literally didn't have to think about it the first time.

[–] hulemy@ani.social 5 points 2 years ago (1 children)

got any online course recommendations? my college recommended missing semester for the basics of the basics, but i know there are so many more and other vim workflows (easy motions etc)

although i should first start getting into touch typing

[–] CriticalMiss@lemmy.world 2 points 1 year ago

In the terminal write ‘vimtutor’, that covers the basics.

[–] glitches_brew@lemmy.world 7 points 2 years ago

"All my homies hate :wq"

  • :x gang
[–] AVengefulAxolotl@lemmy.world 4 points 1 year ago

At first I did now understand it, why would you even use it??(vim / neovim) It would take ages to learn it all. Then got around to try it, and in a span of like a week, I couldnt go back to editing text with a mouse. I wasnt efficient at first, but damn was it fun. Just cruising around the codebase without touching the mouse (as much as i could.)

Yeah, it makes you more efficient if youve learnt it enough, but at the same time, it makes editing literal text way more enjoyable. You need to edit some boilerplate, and it actually becomes somewhat interesting like: 'Can I use a macro here', or 'How can i do it the most efficient way?’.

I think it also gives you a state of mind as well (for me it definitely shaped it.) You want to learn your tools, you want to understand what makes a good text editor (ex. LSP), or just perfecting your usabilitx of a terminal / shell.

At the same time, damn sometimes its a straight up curse that i learnt vim. I open any other text editor and i just curse the whole time: 'Where are my vim motions?!!?

P.S. Remapping Escape to Caps Lock made vim usability to a 10 for me.

[–] glizzyguzzler@lemmy.blahaj.zone 3 points 2 years ago (1 children)

First time using Linux and in a job setting isn’t the time to get Vim’d, so yeah I dipped. Don’t judge too hard pls!

[–] Theharpyeagle@lemmy.world 3 points 2 years ago* (last edited 2 years ago)

I actually learned while writing docs for work because it was boring as fuck otherwise. Now I'm one of those people. Give it a shot if you want to spice up (and dramatically slow down at first) some tedious work for a bit.

[–] reverendsteveii@lemm.ee 1 points 2 years ago (1 children)

it's literally the first result on Google

Okay, how do I Google in vim?

[–] AVincentInSpace@pawb.social 1 points 1 year ago* (last edited 1 year ago)

step 1. alt
step 2. tab

alternately:
step 1. switch VTs back to your desktop environment and Google it there

if you're using vim without a GUI running at all (I hate embedded systems too):
step 1. you still have your phone on you, right

[–] bestonecrazy@lemmy.zip 17 points 2 years ago (1 children)
[–] itslilith@lemmy.blahaj.zone 24 points 2 years ago* (last edited 2 years ago) (1 children)
[–] bestonecrazy@lemmy.zip 15 points 2 years ago (1 children)
[–] itslilith@lemmy.blahaj.zone 15 points 2 years ago

you have escaped

[–] cupcakezealot@lemmy.blahaj.zone 16 points 2 years ago (4 children)

lawful good: alias vim=nano

chaotic evil: alias nano=vim

[–] AVincentInSpace@pawb.social 13 points 1 year ago

If I typed vim and it opened nano I would start looking for people to kill

[–] Pipoca@lemmy.world 7 points 1 year ago

Setting vim to alias to nano seems just about as chaotic evil as making the VS Code icon take you to notepad.

I would detonate if someone chaotic evil’d me

[–] Pipoca@lemmy.world 5 points 1 year ago

I dunno, those both seem pretty chaotic evil to me.

[–] Novman@feddit.it 14 points 1 year ago (2 children)

I develop only in vim, i find it way better that any modern gui.

[–] replicat@lemmy.world 7 points 1 year ago (2 children)

VSCode with the VIM mode plugin is kind of the best of both worlds.

[–] Novman@feddit.it 6 points 1 year ago

I dislike the graphical interface. Console helps me to be more productive.

[–] soupuos@sopuli.xyz 1 points 1 year ago

Maybe it was just me, but I found VSCode's undo/redo vim trees (u/r) to be kind of awkward when compared to real vim.

[–] janabuggs@beehaw.org 1 points 1 year ago (1 children)

Native vim? Or with an elaborate preference file?

I personally have grown so accustomed to vim that if I have to ssh to a new (to me) server I would rather use stock vi (which in most systems is actually an alias for vim) to any other editor. But honestly I have made an alias for a script that ports over my elaborate vimrc file for every first login to a new server or instance lol. It makes me feel a little like a diva 💁💅

[–] Novman@feddit.it 2 points 1 year ago

Vim with a minimal preference file, but sometimes vim only, i don't like vi cause it lacks syntax highlighting

[–] biscuitswalrus@aussie.zone 13 points 2 years ago

Quitting Vim is called 'escaping' because it was designed to be a trap and you've escaped. Congratulations to everyone who has.

[–] phorq@lemmy.ml 9 points 2 years ago

Who told you to add a job to your root crontab? Vim was just protecting you from yourself

[–] Dasnap@lemmy.world 8 points 2 years ago (1 children)
[–] zorro@lemmy.world 6 points 2 years ago

I think someone else mentioned this but just run vimtutor in your command line for a pretty exhaustive tutorial.

[–] Draconic_NEO@lemmy.dbzer0.com 6 points 1 year ago* (last edited 1 year ago)

:q it's very easy. You could also just close the terminal window and easily escape that way.

[–] al177@lemmy.sdf.org 6 points 2 years ago

[CTRL][ALT][PrtSc]-K-S-U-B

or [ESC] :q!

YMMV

[–] AeonFelis@lemmy.world 5 points 2 years ago (2 children)

Doesn't work with laptops.

[–] glitches_brew@lemmy.world 10 points 2 years ago

It does, but it takes longer

[–] reverendsteveii@lemm.ee 2 points 2 years ago

Yeah it does, it just takes longer

[–] Smorty@lemmy.blahaj.zone 4 points 1 year ago

Type :q to exit.

[–] Kerb@discuss.tchncs.de 4 points 1 year ago

:killall -9 vim

[–] HappySloth@discuss.tchncs.de 2 points 2 years ago

This is the way!