r/programming • • Apr 01 '19

Stack Overflow ~ Helping One Million Developers Exit Vim πŸ˜‚

https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/
2.5k Upvotes

441 comments sorted by

View all comments

Show parent comments

17

u/instanced_banana Apr 01 '19

As someone who uses Linux in his main PC, I now feel kinda bad to not know how to exit Vim. Kinda because I enter in those 3 groups.

26

u/Acceptable_Damage Apr 01 '19

Escape :q!

9

u/flukus Apr 02 '19

ZZ

10

u/ub3rh4x0rz Apr 02 '19 edited Apr 02 '19

ZZ = :wq :x

ZQ = :q!

edit: fixed ZZ equivalency

4

u/stone_henge Apr 02 '19

ZZ isn't exactly equivalent to :wq. ZZ only writes the file if it has been modified. For an example where this difference is significant, open a new, named file without actually editing it and try ZZ. Then do the same with :wq. In the former case no file will have been written. In the latter case you'll have an empty file.

→ More replies (1)

1

u/[deleted] Apr 02 '19

No, ZZ is the same as :x (only save if the file was modified). :wq always writes to the file.

→ More replies (1)

2

u/jl2352 Apr 02 '19

TIL.

Here’s me using :q for all these years like a schmuck.

4

u/EntityDamage Apr 02 '19

:Q

Shit, caps lock was on

:q

Now it's recording? Shit!

:q :q :q FUCK JUST EXIT!!

2

u/MuonManLaserJab Apr 02 '19

<C-Z>killall vim<CR>

→ More replies (1)

11

u/ekun Apr 02 '19
  1. 'ctrl+z' to send the vim process to the background

  2. then search for the process id with this command

ps aux | grep vim

3. then use sudo to kill that process id

sudo kill -9 processID

4. then enter your password

password:

5

u/Jonno_FTW Apr 02 '19

killall vim for the same effect.

1

u/ekun Apr 03 '19

Yeah! I was making this convoluted intentionally.

2

u/Jonno_FTW Apr 03 '19

Here's a better technique

sudo rm `which -a vim`

2

u/[deleted] Apr 02 '19

[removed] β€” view removed comment

1

u/cleeder Apr 02 '19

Don't even need the job number. % Will just refer to the last suspended job after a ctrl + z

1

u/wewbull Apr 02 '19

Why sudo? You own the process.

2

u/ekun Apr 02 '19

You are correct. It's all overkill.

→ More replies (2)

1

u/cleeder Apr 02 '19

Too many steps.

Ctrl + z (Suspend)

kill % (Kill last suspended job)

2

u/ekun Apr 02 '19

I was trying to make it as obnoxious as possible.

1

u/saltybandana Apr 02 '19

if you type 'fg' by itself it will resume the most recently suspended process.

7

u/ruinercollector Apr 01 '19

Type :q in edit mode.

3

u/ChillTea Apr 02 '19

edit mode

Triggered!

→ More replies (2)

1

u/Gloinson Apr 02 '19

Escape-ZZ ;)

→ More replies (1)