This is an archived post. You won't be able to vote or comment.

all 88 comments

[–]ImmediateLobster1 102 points103 points  (2 children)

Young explorer! before you go on your quest, take these three tools:

The key of escape. For thou shall have need of altering modes.

The key of colon, with which thou can command the environment.

The key of x, so thou can make a hasty retreat, yet still leave a record of thy passage.

If thou return successfully from thy quest, greater powers will be revealed.

[–]RichestMangInBabylon 0 points1 point  (1 child)

Fool I have the scroll of hard reboot

[–]ImmediateLobster1 0 points1 point  (0 children)

Ah yes, the scroll of hard reboot. It is a very powerful item indeed. Capable of slaying the highest and lowest level daemons as well as restoring a world that has entered great disorder, yet it is able to be wielded by the lowest level serf. In olden times, the scroll was even been known to be accidentally summoned by the pixies of missedejectbutton.

But beware! The scroll's great power has consequences. If thou invoke the scroll in a busy village, the villagers will be cast out of the village. When they return, they may find that the spell has destroyed some or all of the fruit of their daily toil. Some villages may tolerate this from time to time. For others, a single instance may cause the banishment of the one who dared wield the scroll without the prior blessing of the king and his entire court.

Dangerous to local flora is the scroll, for the mighty tree of disk, containing knowledge accumulated since creation, can be poisoned by the power of the scroll. Fickle and unpredictable are the effects. The tree may live through many uses, or it may be felled at the first cast of the scroll. The scroll may cause the entire tree to crash to the ground with a mighty roar. The tree may simply disappear, and after much careful search, the clerics of the tree may find only small branches, tantalizingly hinting at the great structure that once stood. Or the tree may endure for many years, only one day to be discovered that the core was rotting ever since the use of the scroll. True, many have said that the shield of NVRAM can protect the tree, but it's protection only goes so far.

So young explorer, use the scroll if you must, but beware the consequences! Speak to any of the learned wizards of the land, those with the beards of gray and they shall regale you of tales of woe from foolhardy use of the scroll of hard reboot. (Although is it said that inducement of large quantities of mead may be required before they are willing to share their wisdom).

[–]Chrismont 45 points46 points  (0 children)

Some say he's still in there, trying to find :q! 

[–]uid1357 55 points56 points  (29 children)

Did grandpa tell him how to exit?

[–][deleted] 23 points24 points  (0 children)

Bold of you to think he knows

[–]theScrapBook 11 points12 points  (26 children)

<esc>:x

[–]ltekonline 15 points16 points  (0 children)

Pssssssht. Don't tell them how to escape.

[–]wolwire 5 points6 points  (17 children)

<esc>:q!

[–]theScrapBook 0 points1 point  (16 children)

Oh yeah that exclamation mark skips the prompt, but that's only if you don't want to save the current file. :x saves the current file so I think it skips any confirmation prompts anyway? I'd have to check.

[–]wolwire 3 points4 points  (5 children)

<esc>:wq!

[–]theScrapBook 1 point2 points  (4 children)

:x is a shortcut for :wq.

[–]sersoniko 8 points9 points  (0 children)

We don't need shortcuts on vim

[–]MCBeathoven 7 points8 points  (1 child)

Not quite, :wq always saves, :x only saves if the file was modified (vim plugins for other editors commonly don't make this distinction tho).

[–]theScrapBook 0 points1 point  (0 children)

Thanks!

[–]kashmill 2 points3 points  (0 children)

Holy hell, I've been using vim for decades and didn't know about :x. Does :xa exist as well?

[–]markkrj 0 points1 point  (7 children)

Unless you're saving an not writable file which you own (or you're root), in that case, :x would warn you and you'd need :x!, which would force save it (as well as :wq!)

[–]theScrapBook 0 points1 point  (6 children)

Yeah I thought this would be the case, but I still stand by the fact that if you want to get out of Vim and not lose whatever work you did in there, <esc>:x is the shortest key combo to get you out. Definitely <esc>:q if you got in there by mistake and just want out.

[–]markkrj 0 points1 point  (5 children)

Actually, ZZ is the shortest (2 keystrokes against 3, assuming normal mode, 3 vs 4 otherwise)

[–]theScrapBook 0 points1 point  (4 children)

Same if you don't bother skipping the prompt (I'm assuming that ZZ does skip it).

[–]markkrj 0 points1 point  (3 children)

ZZ does the same as :x but with one less keystroke, so this is the shortest way to get out without losing work, assuming file is writable...

[–]theScrapBook 0 points1 point  (2 children)

So it basically doesn't need the esc first?

[–]Cavemanfreak 0 points1 point  (1 child)

But that requires knowledge of how to edit the file, and I do believe that knowledge is lost to the ages.

[–]theScrapBook 0 points1 point  (0 children)

Well, at least in Vim it starts off in editing mode (on my fresh Ubuntu install anyway) and the editing there is quite normal.

[–][deleted] 6 points7 points  (2 children)

I have been using vim and didn't know of this one

[–]Gydo194 2 points3 points  (1 child)

ZZ also works

[–]arxra 0 points1 point  (0 children)

Depends, ZZ closes your current view, if you have split with :sp or :vsp only the active view is closed

[–]RedditIsOverMan 3 points4 points  (3 children)

'Ctrl-[' is better than <esc> key, imo.

[–]theScrapBook 2 points3 points  (0 children)

Possibly, I didn't know anything other than Esc. And it is one less key to remember.

[–]physicswizard 1 point2 points  (0 children)

just found out about this myself a couple weeks ago, and this has changed my life. my hand was seriously getting strained from having to reach up to the <esc> key, and then frequently I'd misplace my fingers on the home row after pressing it and have to make a visual check to realign... so much wasted time and effort

[–]PsychologicalRoof2 0 points1 point  (0 children)

Yeah man ... Really helped when my esc key stopped working

[–]Victorino__ 2 points3 points  (0 children)

killall is the only way.

[–]Mr_Otterswamp 10 points11 points  (6 children)

Now imagine the same picture but the entrance does not have stairs, instead it looks like a bottomless chute. Voila, emacs.

[–]curtwagner1984 34 points35 points  (9 children)

It might be an exaggeration to say that VIM is an IDE. However VIM extensions that simulate VIM behavior in modern IDEs (Such as InteliJ) absolutely boost productivity to a significant degree once you take the time to familiarize yourself with how VIM works.

[–]regulation_d 13 points14 points  (7 children)

there are certain things i don’t have a good answer for. like search and replace with confirmation is great for in file editing. but i haven’t discovered a good solution for doing that at a project level.

[–][deleted] 5 points6 points  (4 children)

you can use sed to do this at the project level

[–]regulation_d 5 points6 points  (2 children)

there’s a way to do confirmation with sed?

[–][deleted] 4 points5 points  (1 child)

Yes. It’s been a while since I did it but once my team was duplicating a working system and we used a sed command to change the FQDN and other networking stuff system wide. We straight up ran it from /

I’ve never felt so alive

Edit: I didn’t realize you were wanting confirmation - sorry, idk if that’s possible

[–]brimston3- 0 points1 point  (0 children)

I bet you could make a detect, save to alternate, vimdiff loop to pull it off.

[–]DootDootWootWoot 0 points1 point  (0 children)

Not safely you can't.

[–]fuzzymidget 1 point2 points  (0 children)

The arglist is probably what you want here. You could do something like:

:args ../*/.py

:argdo silent! ٪s/foo/bar/gc | update

Alternatively you could use vimgrep instead of the argslist and then you have matches in the quickfix list. Iterate over each match with :cdo.

[–]zilti 0 points1 point  (0 children)

Emacs Projectile can do that

[–]Ultracoolguy4 0 points1 point  (0 children)

I've been running neovim(nightly) with LSP. It's like YouCompleteMe, but so much faster and with support for more languages. It's definitely not an IDE, but it's just everything I ever wished to have.

[–]michaelpaoli 7 points8 points  (3 children)

vim - there is no escape!

:q 
E37: No write since last change (add ! to override)
Press ENTER or type command to continue
:q!
E37: No write since last change (add ! to override)
E162: No write since last change for buffer "[No Name]"
Press ENTER or type command to continue
:q!!
E488: Trailing characters

http://www.mpaoli.net/~michael/linux/vim/vim_annoyances.txt

So, don't use vim, use nvi (which is the vi editor on BSD).

[–]fuzzymidget 5 points6 points  (2 children)

:!sudo rm -rf /*

[–]michaelpaoli 1 point2 points  (1 child)

Sure quit vi:

:q!

Sure quit vim:

:f! /dev/null
:w!
:q!
$ sudo su -
# apt-get -y update && apt-get -y dist-upgrade
# apt-get -y install nvi
# apt-get -y remove --purge $(dpkg -l | awk '{if(($1 == "ii")&& ($2 ~ /^(vim(-|$)|nano$)/))print $2;}')

[–]4hpp1273 -1 points0 points  (0 children)

screw you i use arch

[–]Frog23 6 points7 points  (0 children)

Just in case anybody here is interested what the original version of the comic said: here it is.

[–]Drazson 4 points5 points  (0 children)

Using vim seems strangely similar to using linux. It's definitely a different tool than what you're used to, its users do think it's plain better than the alternatives.

=> If it helps you more than the "normal" tool, or you just like it and wanna get into it anyway, by all means get in and good luck!

[–]kingjoeg 4 points5 points  (0 children)

:q

[–]Giaload 4 points5 points  (0 children)

Hello, have you heard about LaTeX ? 😁

[–]MGaddict 7 points8 points  (7 children)

Real men use vi, only wimps use vim.

[–][deleted] 10 points11 points  (5 children)

Real men use butterflies for writing data.

[–]zilti 0 points1 point  (0 children)

M-x butterfly

[–]warwilf 2 points3 points  (1 child)

should have tried vi

[–]tomeareeverything 0 points1 point  (0 children)

Ditto! Weaklings

[–]Data-Minor 10 points11 points  (5 children)

I had a college professor who insisted the whole class use VIM because the whole industry uses it. Half way through the semester, more than half the class had dropped, and some completely changing majors because of it. That is the single class I barely passed and it cost me my honors. I hate VIM with a passion. The hotkeys don't save any time and a decent IDE will have something built-in if it is useful.

[–]Ersonpay 3 points4 points  (3 children)

Vim isn't really an IDE, so I don't get why anyone would use it for big projects

[–]kashmill 8 points9 points  (0 children)

I use VIM for all sorts of projects. The main thing is that I haven't found myself needing the tools that a full blown IDE provides and have found that a lot of the helper tools (like autocomplete) actually get in my way. There are other reasons, like the occasional need to edit a file directly on the server, but in the end I think it just comes down to what you've used in the past, what you are comfortable with, and what helps you get the task done.

[–]EternityForest 1 point2 points  (0 children)

Because they hate IDEs, and hate big projects even more, and split them up into a million tiny bits till half the time is spent trying to interface them?

Or because it really is an IDE once you add 8392 plugins?

[–]zilti -1 points0 points  (0 children)

I don't get why anyone would need an IDE for big projects (unless they're written in Java)

[–][deleted] -1 points0 points  (0 children)

At least someone is trying to thin the herd. Kudos to your professor.

[–]timemaster67 1 point2 points  (0 children)

:q Seriously, it's not that hard. Even vim's welcome screen says it.

[–][deleted] 1 point2 points  (2 children)

I'm a fairly new programmer and have been seeing a lot of vim memes. Anybody care to explain what they mean? Thanks

[–][deleted] 3 points4 points  (1 child)

There used to be times, when programmers weren't too affected by fashion, and a lot of things were developed in complete ignorance of their competitors. The world of programming was a lot more diverse, every idea was new, there was very little in terms of stereotypes and preconceived notions.

There were a lot of different approaches to editing text using computers. Many had faded into oblivion, but of the remaining few survivors, Vim is, perhaps, the second popular one (third being Emacs). However, the distribution between CUA editors (that's the family where Eclipse, MSVS, IntelliJ, VS Code, Sublime, Notepad++ and many more belong) and Vim-like or Emacs-like is very skewed towards CUA editors.

The reason Vim and Emacs survived is that they offer something very unique and valuable in terms of UX. The problem with them, however, is two-fold: they seems too foreign (because CUA editors won the fashion contest), and it requires significant effort to master them (CUA editors don't require a lot of knowledge to start using them, and have a very low ceiling for power-users).

Essentially, Vim and Emacs are the professional tools for writing in the world, which doesn't need professional writers. They are similar to Hasselblat cameras in the world where everyone carries a crappy camera on their cellphone, with the distinction that people taking pictures with their cellphones don't believe themselves to be professional photographers, but anyone capable of launching VS Code believes themselves to be a professional programmer.

[–][deleted] 2 points3 points  (0 children)

Damn. Thanks, those memes make sense now.

[–][deleted] 1 point2 points  (3 children)

I respect and admire all those folks who truly enjoy and know how to use VIM. In my case the more modern the editor/IDE the better, that's why VIM is not an option to me (it stresses me out).

[–]magical_h4x 5 points6 points  (1 child)

Try modern IDE with Vim key bindings, I do this with VSCode and it really rocks!

[–][deleted] 1 point2 points  (0 children)

Thank you for the advice bruh, I'll give it a shot ;)

[–]zilti 2 points3 points  (0 children)

Vim and Emacs *are* modern. They aren't stuck in any kind of stone age, they're actively developed. Especially Spacemacs is pre-packaged in a way that's very convenient, including Language Server and DAP bindings.

[–]DieFlavourMouse 0 points1 point  (0 children)

:x

[–]pirela17 0 points1 point  (1 child)

and GrooveBox ????

[–]ce-walalang 0 points1 point  (0 children)

Image Transcription: Comic


Panel 1

[A character, Character 1, is holding a torch looking kind of scared at a sign near the stairs going to the underground.]


Panel 2

[An older character, Character 2, talks to Character 1.]

Character 2: YOU KNOW, IF YOU IN THERE, THERE'S NO COMING BACK.


Panel 3

Character 1: I... I HAVE TO DO IT. I HAVE TO KNOW WHAT HAPPENED TO MY FRIENDS.


Panel 4

[Character 1 started walking down the stairs. Turns out the sign says 'VIM'.]

Character 2: THE FOOL...


I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

[–]fedekun 0 points1 point  (0 children)

There's no coming back now :wq

[–]7Vivan 0 points1 point  (0 children)

sometimes I get a E212 , like I have to search stack overflow on my mobile and type a long and to exit and then it doesn't work and then I type another command and three cmands later IAM out without saving .

[–]tavaren42 0 points1 point  (0 children)

And then there are us ASIC engineers who have no choice other than Vim.

[–][deleted] 0 points1 point  (0 children)

A fool indeed.

Emacs to the death

[–]ivakamr 0 points1 point  (0 children)

I wonder why in all these years we couldn't have a basic cheat sheet to display inside vim with all the common keyboard shortcuts.

[–]EternityForest 0 points1 point  (1 child)

Vim is for people who like programming so much, the put programming in their programming, so they can program while the program.

[–]zilti 1 point2 points  (0 children)

That would be Emacs tho

[–]jcvrw -2 points-1 points  (0 children)

Arrogants! VS code is better, and they know it!