this post was submitted on 05 Dec 2023
879 points (98.1% liked)

linuxmemes

26006 readers
309 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. πŸ‡¬πŸ‡§ Language/язык/Sprache
  • This is primarily an English-speaking community. πŸ‡¬πŸ‡§πŸ‡¦πŸ‡ΊπŸ‡ΊπŸ‡Έ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • Β 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 2 years ago
    MODERATORS
     
    top 50 comments
    sorted by: hot top controversial new old
    [–] vsis@feddit.cl 34 points 2 years ago (1 children)

    wrong: you press esc multiple times to make sure you are in normal mode.

    [–] treadful@lemmy.zip 15 points 2 years ago

    At least 3 times. 5 to make sure.

    [–] MTK@lemmy.world 30 points 2 years ago (3 children)

    I just shoot myself whenever I want to leave vim

    [–] iAvicenna@lemmy.world 14 points 2 years ago (2 children)

    You don't need to be so drastic just shut down the electricity by the main switch

    [–] GoosLife@lemmy.world 13 points 2 years ago (1 children)

    I rent a place where I don't have direct access to the main switch, so what I do is I just stop paying utilities until Vim closes :)

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

    Or just shoot the main switch if you at least have a line of sight on it

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

    you can just unplug your pc: and that way you won't incur downtime for the rest of the house.

    load more comments (2 replies)
    [–] doctorn@r.nf 25 points 2 years ago (1 children)
    [–] hemko@lemmy.dbzer0.com 19 points 2 years ago (2 children)

    You shouldn't really use editor with sudo, but instead use sudoedit to edit files restricted to root user

    SUDO_EDITOR=nano sudoedit /etc/fstab

    This accomplishes the same function while running the text editor as unprivileged user

    [–] doctorn@r.nf 10 points 2 years ago* (last edited 2 years ago) (2 children)

    Why?

    Files from user: nano

    Files from root: sudo nano

    Files from another user: sudo nano (and if new sudo chown after)... πŸ˜‚

    Never had any problems with this in over 10 years... πŸ˜…πŸ˜‚

    [–] Hawk@lemmy.dbzer0.com 12 points 2 years ago (2 children)

    Doing sudo nano will not load your user configuration, sudoedit will. I had plenty of problems with this, but I assume you don't have any custom configuration.

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

    One reason why sometime I don't do sudoedit is that I make a lot of changes to the config/restart service/see it works/edit etc.. sudoedit only write to the file when exiting, so that flow won't work...

    for example when having adding a new host on nginx and some configuration and see if everything work (sudo vim/systemc nginx restart/curl https:// domain loop)

    but yeah in general i'll just use sudoedit (which alias to se for me) for my root editing

    [–] doctorn@r.nf 3 points 2 years ago* (last edited 2 years ago)

    I just have a root custom config too. πŸ€·β€β™‚οΈ This even allows me to easily use different configs for root than for the user.

    Made with 'sudo nano', fyi. πŸ˜‚

    [–] hemko@lemmy.dbzer0.com 3 points 2 years ago (1 children)

    As mentioned, to prevent running your text editor with root permissions. It's just security optimization

    [–] doctorn@r.nf 4 points 2 years ago (12 children)

    Let me rephrase my question:

    Why would I not want to open nano as root?

    No offense, but that sounds like more OCD behavior. πŸ˜… I don't need or want protection against myself, and I even loath the whole "that's not how you're supposed to do it"-mentality of linux (where when commands know very well what you want, instead of doing it, just tell you you forgot something). πŸ˜…

    load more comments (11 replies)
    [–] Huschke@lemmy.world 6 points 2 years ago (6 children)

    Alternatively you could use my favorite approach, Visual Studio Code. Just open the file with it, edit it and upon saving you will be promoted if the file needs admin rights to save.

    [–] LaSaucisseMasquee@jlai.lu 6 points 2 years ago* (last edited 2 years ago) (1 children)

    Okay but how can I show how good I am with shortcuts to edit legacy software ?

    load more comments (1 replies)
    [–] MalReynolds@slrpnk.net 3 points 2 years ago

    Yup, s/vsc/kwrite/ personally, it's lighter, but why shouldn't I have a pretty for my config editing needs...

    load more comments (4 replies)
    [–] SigHunter@feddit.de 22 points 2 years ago* (last edited 2 years ago) (2 children)

    until the moment you realize that somehow you are not on your native keyboard layout and where the hell is : and ! in this weird language??!

    [–] lseif@sopuli.xyz 10 points 2 years ago* (last edited 2 years ago)
    [–] JetpackJackson@feddit.de 4 points 2 years ago

    I have done this too many times now lol, you'd think I would have learned

    [–] MacNCheezus@lemmy.today 20 points 2 years ago (1 children)

    "I use Arch Linux btw"

    *doesn't know how to use vim

    Pottery

    load more comments (1 replies)
    [–] marietta_man@yall.theatl.social 19 points 2 years ago* (last edited 2 years ago) (3 children)

    ESC Z Z

    Although I usually bang ESC a few times to
    make sure i’m back to command mode

    [–] lseif@sopuli.xyz 13 points 2 years ago (1 children)
    load more comments (1 replies)
    [–] digger@lemmy.ca 6 points 2 years ago (1 children)

    Double Z's will save and then exit. The command on until board will exit without saving changes.

    [–] Astaroth@lemm.ee 3 points 2 years ago

    yeah to exit without saving you do ZQ instead of ZZ

    [–] topinambour_rex@lemmy.world 3 points 2 years ago

    Shouldn't be Z Z esc ? Because, you know ZZ top.

    [–] TimeSquirrel@kbin.social 16 points 2 years ago (1 children)
    [–] key@lemmy.keychat.org 11 points 2 years ago (2 children)
    [–] WaterWaiver@aussie.zone 7 points 2 years ago* (last edited 2 years ago)

    Alternative:

    Ctrl-z  
    kill -9 %1   # Shell keeps track of job pids for you, job 1 is %1, job 2 is %2, etc
    fg  # Not technically necessary, but it's fun to see the corpse
    [–] possiblylinux127@lemmy.zip 6 points 2 years ago (1 children)
    [–] SpaceCadet@feddit.nl 3 points 2 years ago* (last edited 2 years ago)

    Reminds me of the time I brought down a whole AIX server with the killall command back in the 1990s.

    On AIX killall really means kill every single process.

    [–] Im_old@lemmy.world 9 points 2 years ago (1 children)

    Ok ok, I know it's a meme, but gentle reminder that :x is :w and :q combined (save and exit). I got taught that in high school (it was a dec unix with real vt120 terminals) and luckily for me I remembered that even if I didn't touch vi for a few years afterwards.

    [–] Dasnap@lemmy.world 5 points 2 years ago

    Funnily enough, I knew of :x before :w.

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

    i think you mean ctrl s and ctrl x

    [–] possiblylinux127@lemmy.zip 3 points 2 years ago

    That didn't work

    load more comments (2 replies)
    [–] glowie@h4x0r.host 7 points 2 years ago

    What is this sorcery?! I thought you had to reboot each time to exit.

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

    META-C :wq!

    ESC is all the way over there and my hand is already on the space bar.

    load more comments (3 replies)
    [–] Tenthrow@lemmy.world 5 points 2 years ago (2 children)

    That's only if you don't want to save first (ahem write the buffer).

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

    Odds are if you don't know how to exit vim you probably don't want to save whatever you wrote in there.

    [–] possiblylinux127@lemmy.zip 8 points 2 years ago (1 children)

    Who in there right mind would want to save a bunch of gibberish

    [–] QuazarOmega@lemy.lol 4 points 2 years ago

    ihh splqqiq:wq

    Wear your mistakes proudlyq!

    [–] Turious@leaf.dance 3 points 2 years ago (1 children)
    [–] Zardoz@lemmy.world 3 points 2 years ago (2 children)

    I prefer ctrl-[ instead of escape

    load more comments (2 replies)
    load more comments
    view more: next β€Ί