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

665

u/ender89 Apr 01 '19

I tried to exit vim once in 2007, but I couldn't manage it. Turns out vim is Turing complete, so I just implemented my own operating system because that was easier.

261

u/elsjpq Apr 01 '19

oh so you ported emacs?

202

u/CloudNetworkingIO Apr 01 '19

Great OS. I wish it had a decent editor though.

2

u/SpaceShrimp Apr 02 '19

Someone must have made a vi version for emacs.

2

u/I_ate_a_milkshake Apr 14 '19

its called evil. its the only way to be tbh. Once I went spacemacs i never went back.

2

u/ImSoCabbage Apr 02 '19 edited Apr 02 '19

It does have one, evil-mode implements vim.

→ More replies (11)

45

u/Kinglink Apr 01 '19

Glad you got the network stack working, and are back to your usual productivity on Reddit.

18

u/MuonManLaserJab Apr 02 '19

No, they couldn't get the network working so they just simulated the universe starting from the Big Bang, in pure VimL, then fast-forwarded to the present and jacked themself in (after briefly simulating the future in order to figure out how to jack themself in).

10

u/Amuro_Ray Apr 02 '19

Elaborate flex but ok

13

u/spockspeare Apr 02 '19

Your caps lock is on.

154

u/redfirehose Apr 01 '19

I won't lie - I tried finding that O'Reilly book on Amazon...for a friend.

34

u/SorAnony Apr 01 '19

I read it as O RLY?

23

u/timeshifter_ Apr 01 '19

Well I mean, that's what it says, so...

640

u/cleeder Apr 01 '19

The developers who are most likely to get stuck in Vim are front-end web developers: those who primarily visit tags like JQuery, CSS, and AngularJS. They’re followed by Microsoft developers (C# and SQL Server) and mobile (Android and iOS).

Sounds about what I would expect.

199

u/Flkdnt Apr 01 '19

Don't forget Windows Sysadmins who touch a production Linux server once every couple months. 😂😂😂😂

65

u/ruinercollector Apr 01 '19

I find that the sysadmins usually find out about pico/nano quickly and stay over there...

38

u/Flkdnt Apr 01 '19

Oh I love nano, but sometimes I find myself in Vi looking like a 5 year old trying to learn how to type.

30

u/nicksvr4 Apr 02 '19

Had to use vi yesterday, what a shit show. Couldn't figure out how to append something. Will never forget how to quit these God forsaken applications after getting stuck a couple times in the past.

28

u/static_motion Apr 02 '19

Well appending is one of the most intuitive commands in vi, you just press a. If that inserts the letter "a", press Esc first to exit insert mode then press a.

27

u/tribak Apr 02 '19

How do I remove the `a` that was typed earlier?

→ More replies (8)
→ More replies (3)

18

u/lordlionhunter Apr 02 '19

Am sysadmin. Learned to use vim from other sysadmins. Working on many remote servers and need to be able to make quick changes for debugging or whatever? Vim is the best choice. Works over every ssh connection and once you learn it, it's as good as any text editor.

11

u/meneldal2 Apr 02 '19

I'd argue the butterfly works even better, you don't even need a ssh connection.

10

u/RNGsus_Christ Apr 02 '19

Nice. 'Course, there's a Vim mode for that.

→ More replies (1)

8

u/imral Apr 02 '19

it's as good as any text editor.

No, it's far better :-D

2

u/marcthe12 Apr 02 '19

Flash back to the time I had use ed. Thinking of learning ed actually.

→ More replies (1)

2

u/Dreamtrain Apr 02 '19

Not a sysadmin but nano is the biggest crutch in my life

2

u/ThellraAK Apr 02 '19

Control K deletes a line.

Changed my life.

2

u/ketilkn Apr 03 '19

Problem appear when you do stuff like crontab -e and the default editor is not the one you expect.

So how do I exit nano again? And should I answer yes or no to the question? Painful every time.

→ More replies (1)

2

u/hardolaf Apr 02 '19

My company's Windows admin uses gvim because he hates Windows. But hey, it pays well. Last I heard, he's eligible for up to 150% bonuses.

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)
→ More replies (2)

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.

→ More replies (2)
→ More replies (9)

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 ;)

1

u/[deleted] Apr 02 '19

You know how when you first open a file in vim you have to press i before you can edit the contents? That is a command that enters "insert mode". Vim launches in "command mode". To do anything other than edit text or move the cursor you have to be in "command mode". When you're in "insert mode" you press the Esc key to exit back to "command mode". If you don't do this then any keys you press trying to exit Vim such as :wq will instead be interpreted as text you're inserting into the file.

Most Vim commands start with a :
w stands for write (save changes to the file)
q stands for quit
! instead of w stands for don't save (discard changes)
Some commands have alternate keystrokes that can be considered shortcut ways of accomplishing the same thing, as mentioned below in some other comments.

→ More replies (18)

183

u/KapteinTordenflesk Apr 01 '19

I tried VIM probably 10 years ago, and trying to exit is literally the only thing I remember from the experience.

22

u/chaxor Apr 01 '19

The worst problem I have with vim is copy/pasting to other programs, such as a browser for stackoverflow.

While I appreciate vim's complexity and use it fairly consistently along other editors at work - this fairly major functionality deficit (and other similar small annoyances) are what keep me from using *only* vim.

I know there are ways to do essentially anything in vim - but this is also likely true for any editor, so it's somewhat a null point. The autocomplete issue that many people have brought up here is a valid one, as it is simply one more step to perform to bring vim to the customized editor you desire.

The fact that copy/pasting requires a specific type of vim to be installed, as well as a 1600 word explanation of registers is a bit a of a nuisance. (1,2)

  1. https://stackoverflow.com/questions/3997078/how-to-paste-yanked-text-into-vim-command-line

  2. https://askubuntu.com/questions/60200/how-to-copy-data-between-different-instances-of-vim

Somehow, it's still a great editor and I use it quite often.

9

u/watsreddit Apr 02 '19 edited Apr 02 '19

set clipboard=unnamedplus

That's literally all it takes to make vim use the system clipboard by default. Of course none of us really do, because the defaults are quite useful. I certainly don't want copying some URL in my general web browsing to mess up my registers in vim, save for the registers dedicated specifically for that purpose. Nor do I want basically every vim command to be overwriting the system clipboard all the time. Copy/paste is much more integral to vim than other editors (except for perhaps Emacs), so it makes sense to separate vim's standard copy/paste from system copy/paste.

2

u/dsifriend Apr 02 '19

WTF? I had no idea people had that much problem with it. That hack is nuts. Just use a terminal with proper pasteboard support or install something like XClip. Your modifier key plus the typical CTRL-X/C/V should work as you expect.

1

u/saltybandana Apr 02 '19

I honestly just disable mouse and use the terminal for copying. Most terminals with copy with 'alt+shift+c', and will paste with 'alt+shift+v' or 'ctrl+shift+insert'.

You can literally just go into insert mode and copy.

→ More replies (4)

118

u/rageingnonsense Apr 01 '19

I can sum up my vim usage in 4 commands:

  • :q

  • :w

  • a

  • /

That's it. That's as much as I am willing to learn. If I need anything more powerful than that, it's straight to the ide

5

u/[deleted] Apr 01 '19

I’d at least recommend learning macros. Also:

  • w

  • b

  • G

  • gg

  • <num>G

⊕ the different modes. Visual mode for example.

4

u/King_Joffreys_Tits Apr 02 '19

G and gg are amazing commands

For the uninitiated, (WHILE IN COMMAND MODE) G brings you to the bottom of the file (and keeps you in command mode) and gg does the same but to the top of the file

→ More replies (1)

16

u/[deleted] Apr 01 '19 edited Apr 01 '19

Wow. That's more than the two (three, if you count 'i') I know:

  • :x

  • :qa!

Though, the most important one is this:

git config --global core.editor nano

Because, FFS, I'm editing a commit message, I shouldn't need a Ph.D. in editors to do that.

8

u/hoosierEE Apr 02 '19

git commit -m "firstline" -m "second line" -m "you can keep going"

6

u/montibbalt Apr 02 '19

Yeah, a Ph.D. in the git CLI should be enough for everyone

→ More replies (2)

4

u/[deleted] Apr 01 '19

Learning how to copy and paste was amazing to me. I started looking for other files that needed things copied and pasted just to see it work again.

→ More replies (2)

1

u/[deleted] Apr 02 '19

What about sort uniques!?

1

u/[deleted] Apr 02 '19

v is also helpful.

1

u/[deleted] Apr 02 '19

Yep straight to an IDE with VIMulation installed of course

1

u/[deleted] Apr 02 '19

Thats also as much as it works on vim. I swear to budhas third testicle, most of the vim commands i find on the internet do not work on vim. So the easiest way to do it is to write complete file on windows, on notepad++, and then copy paste it to vim.

1

u/[deleted] Apr 02 '19

If you're already using /, then * might also be useful (search for the word under the cursor).

1

u/DJDavio Apr 02 '19

Sometimes I use ? to search from the bottom instead of the top

1

u/[deleted] Apr 02 '19

Vi is literally the only editor i use besides textarea, and that's 90% of what i use. For last two decades or so. No need to be fancy.

1

u/kingofthecream Apr 01 '19

I can sum up my vim usage in 4 commands:

:q :w a /

But when I type these they simply appear in the object body.

2

u/randomfloridaman Apr 01 '19

esc. Hit esc until they stop doing that

→ More replies (117)

8

u/rabidstoat Apr 01 '19

I am diehard VIM but sometimes I get thrown in emacs, which is the default editor in one of my bash accounts. Like if I'm trying to 'svn commit' and forgot to do the comments on the command line.

The only thing I know how to do in emacs is 'C-x C-c'.

1

u/randomfloridaman Apr 01 '19

I'd be partial to learning emacs, but I'm often working ssh to a BSD system from a Mac. I've already got enough nonstandard key mappings to deal with. Learning emacs shortcuts on top of that is one dimension too many

→ More replies (1)

15

u/OneWingedShark Apr 01 '19

I tried VIM probably 10 years ago, and trying to exit is literally the only thing I remember from the experience.

Exiting VIM: unplug computer.

NOTE: This solution does not work with computers using magnetic-core memory or other persistent-state mechanisms.

17

u/Nyefan Apr 01 '19 edited Apr 01 '19

Won't lie, that's how I exited vim the first time years ago.

I led with ctrl+c, as you would expect, and saw the message Type :qa! and press <Enter>.... You'd think it would be straightforward from there, but I had a very unique experience - for the last 3 months, I had been using Mathematica for work. Now, anyone who uses Mathematica can see where this is going, I'm sure. You see, Mathematica uses a colon-like symbol to delineate commands from variables and operators, and I was just diving into the worlds of linux and programming for the first time, so that was the only context I had to work with. "What's wrong here?" you ask. Here's the link - you insert the delineator in Mathematica by pressing ESC.

So I follow the instructions on the screen - I type <ESC>qa! and am presented with the message recording @a. Well shit. Ctrl+c still doesn't work, pressing <ESC>qa! again types a ! into the sudoers file and says I'm on -- INSERT -- this time. I try looking it up on my phone, and everything says to type :q!, which clearly isn't working. Oh, and I was installing arch and didn't have a ui yet (I couldn't close the terminal), so I turned it off and started the install process again after looking up how to force the terminal editor to be nano by default and bypassing visudo in favor of directly editing the sudoers file.

9

u/OneWingedShark Apr 01 '19

I feel your pain.

That this is not a "once in a blue moon occurrence" is, frankly, a disgrace to the field of computer-science and our profession as Software Engineers.

→ More replies (1)

2

u/pdp10 Apr 02 '19

NOTE: This solution does not work with computers using magnetic-core memory or other persistent-state mechanisms.

I'm glad you were complete about this.

  • Closing vim by power-cycling in 1976: bwahaha!

  • Closing vim by power-cycling in 2006: works.

  • Closing vim by power-cycling in 2036: bwahaha!

3

u/spacechimp Apr 01 '19

Are you out of it yet?

2

u/KapteinTordenflesk Apr 01 '19

To make a long story short, yes I am.

8

u/[deleted] Apr 01 '19

I had similar experience and my first impression was who on earth made this! Now I’m in love with vim, it’s just very practical.

Always interesting to see juniors/interns trying it for the first time. It never gets old.

20

u/[deleted] Apr 01 '19

Yeah I love software that's really unintuitive too. Especially if the UI is totally hidden so you have to guess what options are available! Haha.

3

u/ub3rh4x0rz Apr 02 '19

Vim has a fantastic, intuitive UI and a great help system. You're confusing "intuitive to use and learn over the first 80 hours of use" with "intuitive to use and learn over the subsequent thousands of hours a professional will use a tool."

1

u/[deleted] Apr 02 '19

I didn’t say it’s intuitive. It has a steep learning curve that’s a given, a lot of the good stuff do. But again it’s very practical and it’s everywhere. Once you get used to it, you can edit files very fast on any machine.

→ More replies (4)

1

u/[deleted] Apr 02 '19

it's not hard, you just have to remember to exit edit mode first. Escape + :wq to save and quit (or :q! if you want to quit without saving). Simply do :q after escape to quit if you have made no changes.

I know it's a joke but honestly the folks that can't figure out how to exit vim should probably turn in their nerd cards.

1

u/MetalSlug20 Apr 02 '19

Usability is shit

→ More replies (2)

46

u/DJDavio Apr 01 '19

:q!

55

u/[deleted] Apr 01 '19

You forgot to hit the escape key first.

63

u/[deleted] Apr 01 '19

spamming esc in desperation is first thing people try so I think it is safe to say the poor sop is in right mode

28

u/elsjpq Apr 01 '19

Nah... Ctrl+C is what I try first, followed by frantic bashing on the keyboard, and by then, who knows what mode you're in

→ More replies (2)

8

u/nicksvr4 Apr 02 '19

:q:q[Esc][Esc][Esc]:q[Esc]:q!

7

u/DJDavio Apr 01 '19

Only if you're in insert mode, right?

19

u/cleeder Apr 01 '19

Just mash the escape key every several keys just to be safe.

→ More replies (1)

1

u/watsreddit Apr 01 '19

Assuming you're in insert mode. You shouldn't really stay in insert mode in vim, though.

28

u/LeCrushinator Apr 01 '19

Note that this blog post is almost 2 years old. It's up to 1.88 million views now.

107

u/petdance Apr 01 '19

The jokes about exiting vim are so so so very tired.

106

u/ApertureCombine Apr 02 '19

Oooh, we should start a list.

  • exiting vim is hard

  • fixing one bug -> more bugs

  • Missing semicolons/semicolons in different languages

  • 127.0.0.1 = home

  • C++ is hard

  • copying code from SO (or variations like ctrl+c/ctrl+v most used keys)

  • IE is slow

  • conflating indexing v counting (#0 best programmer, seeing 3 apples when there are 4, etc.)

  • Code compiling immediately is good

  • caffeine -> code

  • seeing ASCII codes or hex values instead of letters/colors

  • Not understanding your own code is funny

  • Backend is messy

  • Javascript is bad

  • Recursion / infinite loop jokes (often w/o understanding the difference) (page points to same page, definition refers to definition)

13

u/Shaddox Apr 02 '19

You forgot: code doesn't work I don't know why, code works I don't know why

9

u/Coloneljesus Apr 02 '19
  • I can't C#

  • Keyboard with only '0', '1', 'Enter' (optional)

  • Python is Pseudocode

  • PHP is bad

7

u/watsreddit Apr 02 '19

Yup. The joke's only been around for, oh I dunno, 40 years?

17

u/miki151 Apr 01 '19

I had the pleasure to attend a talk by Vim's author, Bram Moolenaar (about something unrelated to vim). When it came to QA I was dumb enough to ask him how to exit vim. He also seemed so very tired of this joke.

9

u/wolbscam Apr 01 '19

It's as if there are new developers who get exposed to vim

2

u/IAMA_dragon-AMA Apr 02 '19

It's not like :wq or :q! is particularly difficult to remember. It's just "write and quit" and "QUIT, DAMMIT!!!"

0

u/OctagonClock Apr 01 '19

Maybe if it worked like every other sane piece of software and respected C-c, the jokes would stop.

7

u/watsreddit Apr 01 '19 edited Apr 02 '19

It's very common for interactive Unix programs to use <C-c> to interrupt the current operation as opposed to the entire process. The Python shell does this, for example. Or man. In this way, vim is very consistent with Unix programs, as it interrupts any ongoing operation (like a process spawned in a subshell, for example) and returns you to normal mode. Interactive programs are usually quit with a specifc key, often q. So vim's :q is only one keystroke from man, perhaps the most most ubiquituous interactive unix program.

4

u/[deleted] Apr 01 '19

But ^C is for copying text!

→ More replies (1)
→ More replies (3)

46

u/f801fe8957 Apr 01 '19

Vim is like cigarettes. It makes you look cool, but it’s impossible to quit. source

15

u/KevinCarbonara Apr 01 '19

This is a joke about how both cigarettes and vim make you look gross, right?

44

u/remtard_remmington Apr 01 '19

The difference is that one can cause a severe health problems in the long term, and the other is a tobacco-based recreational drug

2

u/nthcxd Apr 04 '19

I can literally hear the booming sound of emacs users saying in their minds “it also gives you cancer.”

14

u/txdv Apr 01 '19

ZZ

0

u/[deleted] Apr 01 '19

[deleted]

6

u/[deleted] Apr 01 '19

Careful with that !, you might lose your changes.

5

u/[deleted] Apr 01 '19

I'm always careful when I !

2

u/IAMA_dragon-AMA Apr 02 '19

This is even better as someone who reads a lone ! as "bang"

12

u/kawarazu Apr 01 '19

Y'all gotta learn to use vimtutor 30 minutes makes VIM real usable. :D

6

u/rabidstoat Apr 01 '19

Ctrl-F. No edlin?

Ya'll are weak.

5

u/bargle0 Apr 01 '19

That’s a DOS abomination.

The UNIX equivalent is just ed(1).

1

u/rabidstoat Apr 01 '19

Back in the 80s I actually used edlin on my first PC.

11

u/NewFolgers Apr 01 '19 edited Apr 01 '19

My initial experience with this was Watcom vi.. on MS-DOS. Since it was a single-task environment and the masses (myself included) had no Internet, I eventually had no choice but to reboot the machine after bashing on the keys for a few minutes. The creeping realization that such horror can befall me in exploration of such a seemingly-harmless utility shook me to the core - like drowning far from home with all my stuff for the first time in Minecraft.

3

u/[deleted] Apr 02 '19

like drowning far from home with all my stuff for the first time in Minecraft

you have balls. i spent my first night in minecraft holed up in a hastily built shack too scared to peak into a hole that was my window (because arrows). Than i stayed there next day (because creepers) and next night. Sadly, this horror quickly subsided when i got a bit more familiar with the game.

53

u/wildjokers Apr 01 '19

If a developer uses a *nix system (linux, mac os, etc) how do they survive without using VI? I use it dozens of times every day.

I wish every application had VI key bindings. Any serious IDE absolutely has to have a VI plugin, or it is worthless to me.

98

u/ghostfacedcoder Apr 01 '19

how do they survive without using VI?

emacs and nano

45

u/chicametipo Apr 01 '19

mmm nano <3

7

u/Eilai Apr 01 '19

Nano illuminati ftw!

12

u/chicametipo Apr 01 '19

Ctrl + X + Y/N + Enter all day.

→ More replies (5)

16

u/ACoderGirl Apr 01 '19

If a developer uses a *nix system (linux, mac os, etc) how do they survive without using VI?

I mean, it's not the only command line editor. And while I wouldn't set one as my EDITOR, GUI editors like VS Code are really easy to use. I vaguely recall some machines I've seen where Nano is the default EDITOR.

As for the hotkeys... I've never tried to use one of those plugins in an IDE, but I'm not sure I agree that those key bindings are inherently better for any reason. There's definitely value in consistency across applications, though. But many of vim's hotkeys are straight up inferior in my mind. Like take tab navigation. The default is g-t/g-T. That takes longer than the ctrl-tab/ctrl-shift-tab most GUI editors use and less intuitive in my mind (and certainly ctrl-tab is pretty much universal now).

Or consider opening a file. You'd probably use :tabe or :e to open the file from inside vim (to make things confusing, there's several other slightly different such commands). "E" for edit is pretty intuitive... but too bad every other program has cemented on the terminology of "opening" a file and the obvious ctrl-o hotkey. God forbid you get confused and try to use :open in vim, cause that's some archaic old command that I don't even fully understand what it does or why it still exists.

I use vim for quick, command line editing only. It's ideal to not be rapidly switching between windows when unnecessary. Tmux is the only thing I ever set to use vim hotkeys and that's because tmux's defaults are even dumber (I have several modifications because fuck trying to remember some of those defaults).

3

u/[deleted] Apr 02 '19

gt is two index finger movements from the homerow and three to go to any tab! #gt How does that take long? That's actually a lot faster.

4

u/watsreddit Apr 02 '19

Tabs in vim are not the same as tabs in other programs, so that's not really a comparison. Vim's tabs are a collection of windows (or panes if you prefer). Buffers are vim's analog to tabs, and they are incredible. Cycling through tabs is incredibly slow compared to the vim way, which is immediately jumping to a particular buffer based on a partial substring match of a buffer's name. So to jump to a buffer with the name foo.c, you can just type :b foo and you'll jump to it. It supports globbing patterns, so you can do :b foo*.c<Tab> and tab through buffers with the name foo.c, fooBar.c, fooBarBaz.c, etc.

Likewise, :edit is not really comparable to <C-o> in other editors as it is much more powerful. You can use shell globbing to recursively match a pattern in all subdirectories, so you could for example do :e **/*foo<Tab> and tab through all files containing "foo" in the current directory and every subdirectory. You can even use wildignore to exclude certain results, much like a gitignore.

All of this is just the tip of the iceberg for these two commands, and indeed, vim as a whole. Vim's defaults are very effective and sensible if you take the time to learn them.

6

u/[deleted] Apr 01 '19

I learned to code on Solaris 7 in ksh with vi through a putty terminal. I remember the day I discovered :syntax on after we'd upgraded to Solaris 8, and it changed my life.

1

u/[deleted] Apr 02 '19

It changed my life too. Now i have to google each time i have a new system how to turn syntax highlighting off because i can't read dark blue on black comments and in general can't stand that eye-gouging color salad explosion.

→ More replies (1)

38

u/[deleted] Apr 01 '19

Nano, or even better Micro. It has modern keyboard shortcuts. How do you think you exit Micro?

Blows my mind that people still think vim is a sensible default editor in any situation. Fine, if you love it use it, but it's total madness to have it as the default. It kind of shows how little regard most Linux devs have for usability, and tangentially why there will never be a year of Linux on the desktop.

7

u/drunkdragon Apr 02 '19

I think you hit the nail on the head.

Hitting roadblocks like this are only going to feed the idea that Linux is hard to use for newbies.

Sometimes when you've been trying for hours to get something working, you just don't want more roadblocks.

The Linux community should be mindful of this.

1

u/Hauleth Apr 01 '19

Want to be POSIX? Then vi is must have. And TBH most graphic distribution come with different editors OOtB and many of them use nano as the default $VISUAL.

1

u/stone_henge Apr 02 '19

An editor like Nano trades long-term usability for a user-friendly initial experience. You can learn and master it in minutes, but once you do, you realize that it's a rather primitive editor that makes notepad.exe look like a power tool. With an editor like Vi you have to invest a lot more time in learning it, but the return is long-term usability.

IMO user-friendliness/affordability shouldn't be confused with usability.

→ More replies (14)

3

u/verrius Apr 01 '19

ed? ...I've unfortunately been on AIX systems that only had vi support (no vim) and one thing you learn is that vi had hard max file size limits back in the day.

2

u/ironnomi Apr 01 '19

Max file size limits would suck ... as I fix this 845GB banking import file. :D

2

u/instanced_banana Apr 01 '19

As a heretic, either Nano, VSCode or Pluma.

3

u/Sayfog Apr 01 '19

Yep nano for quick and dirty CLI edits, VS Code gets opened for literally anything else. Keyboard shortcuts aren't why I liked using IDEs, the higher order language features such as mouse over comments and autocomplete are.

2

u/wildjokers Apr 02 '19

VSCode actually has a really nice VI plugin. I use VSCode for Arduino and OpenSCAD and really like the fact it has a vi plugin.

2

u/[deleted] Apr 02 '19

gedit for one-off and elevated file editing, vs code or atom for projects

2

u/[deleted] Apr 01 '19

I like vim as a cli editor but what is the reasoning/point for having a VI/VIM plugin in UI IDE?

12

u/xtownaga Apr 01 '19

The keyboard shortcuts for manipulating text are faster than the ide equivalents once you're used to them, and there's nothing you need to go into a menu / use the mouse for. Things like moving the text cursor down a few lines and to the beginning of a line, or doing a regex find/replace are quick and easy to do with a vim plugin without needing to move my hands off the keyboard (or over to the arrow keys).

If I want to, say, add a comma to the end of lines 27-38 in some file, it's a lot faster to <esc> :27,38s/$/,/ <Enter> than to (in IntelliJ) command-R, $ <tab> , alt-x, Click In Selection checkbox, highlight the lines (either with the mouse or with some text shortcut), alt-a. It's a somewhat contrived example, but stuff like that

Personally I wouldn't go anywhere near so far as to say an IDE is worthless for me without it, but it makes me somewhat more productive.

6

u/KinterVonHurin Apr 01 '19

Because once you get used to it productivity skyrockets

2

u/wildjokers Apr 01 '19

Navigate around the file with h,j,k,l. Yank (yy), put ( p), delete (dd), mark then copy/paste with v, yy, then p. Basically do everything I need to do to edit a file, but inside an IDE without having to touch the mouse or learn an IDE's custom keymap for basic editing.

1

u/Amuro_Ray Apr 02 '19

Necromancy

9

u/shim__ Apr 01 '19

killall doesn't discriminate, works for any rouge editor

6

u/semarj Apr 02 '19

Or it only discriminates on color?

4

u/[deleted] Apr 01 '19

During my first dev job, I ran into my first git merge conflict, fixed it, then it opened VIM. I embarrassingly asked my boss how to exit the screen. Felt like a noob. Was a noob.

→ More replies (2)

3

u/mroximoron Apr 01 '19

I learned to exit vim before stackoverflow existed ;-)

3

u/LesterKurtz Apr 01 '19

cool... now do emacs

3

u/[deleted] Apr 01 '19

I know two commands in vim: insert and BEEP.

3

u/stfm Apr 02 '19

Nano 4 lyfe

5

u/WalterBright Apr 01 '19

I had to buy a new computer because I couldn't exit vim.

4

u/gct Apr 01 '19

emacs/magit master race reporting

2

u/PrestigiousInterest9 Apr 01 '19

I entered vim while using chomebook. Usually the terminal is in the browser, the browser doesn't send ESC to the terminal when you press it. How do I exit vim?

7

u/[deleted] Apr 01 '19

C-[

alternatively, if you're already in normal mode you can inoremap kj <esc> and from then on just use kj to exit insert mode. If you need to type 'kj' while in insert mode then just wait a second between the two presses.

2

u/PrestigiousInterest9 Apr 01 '19

C-[

I'm not sure what this means. Press C and [? what does - mean? All three of those buttons?

2

u/[deleted] Apr 01 '19

<Ctrl><[>

Control + Left [a.k.a open] Square Bracket at the same time. In vim, any time you see a key binding such as C-[ you press control plus the key following the hyphen

2

u/PrestigiousInterest9 Apr 01 '19

I thought + meant that (ie ctrl+[)

→ More replies (2)
→ More replies (1)

2

u/jabbalaci Apr 01 '19

When I was a freshman, we got an account to a Unix server. We also got an email address and we used the pine terminal-based email client. We had a huge lab where anybody could go in and use a free machine. Once I found Midnight Commander and it was very familiar since under DOS everybody used Norton Commander. I was happy to have such a friendly file manager under Unix. And then I pressed F3 (view) on a file and vi opened and I got stuck. As it turned out later, the admin set EDITOR to vi in the global /etc/bashrc file. What the hell? How to quit? I had no idea. After a few minutes of struggle I asked an older guy to help me. When he saw my screen he laughed and showed me the trick: :q. After this I avoided vi for three or four years. But then I decided to learn it and since then I've been using it :) So that's my story with vi(m).

2

u/bargle0 Apr 01 '19

Real programmers use TECO.

2

u/Number1Millenial Apr 02 '19

He doesn’t even tell us how to quit VIM!!

2

u/bartturner Apr 02 '19

This is really funny. Have to tell my story.

At University and finishing up a program assignment in Turbo Pascal.

For some reason just completely forgot how to exit Turbo Pascal. This is before the Internet. So drove down to a local book store to find the sequence. Which is control K and then a D.

Which is the craziest exist sequence there is, IMO.

1

u/mxalfrod Apr 01 '19

Been there, done that.

1

u/3lRey Apr 01 '19

I booted up vim by accident on my new linux subsystem and I guess they knew I was a casual because they put the exit information right there.

1

u/[deleted] Apr 02 '19

That's actually the default behavior (you have to turn it off in your .vimrc if you don't want it). :-)

Vim is surprisingly nice and friendly in some aspects: If you run it without giving any arguments, the first thing it shows is 1. how to exit (:q) and 2. how to access the built-in documentation system (:help). (What it doesn't mention: F1 also opens the manual.)

The first thing :help tells you is 1. how to move around, 2. how to exit the help window, and 3. how to exit vim. (Followed by more information on how to navigate the help system.)

That's something I really missed when I tried out emacs.

1

u/3lRey Apr 02 '19

Wow thanks for the info. I'll have to boot it up and play around.

1

u/sw33t_t34 Apr 01 '19

There's a nice Vim plugin for this as well:

https://github.com/cabellwg/exit-vim

1

u/etcetica Apr 01 '19

bet the april fools comic sans was shitwood's idea

1

u/Kinglink Apr 01 '19 edited Apr 02 '19

I was ready for some April tomfoolery but congratulations StackOverflow you did it!

Thought it's not the most viewed question in case you also were wondering.

1

u/scaleable Apr 01 '19

jquery developers definitely dont get well with vim

1

u/xorian Apr 01 '19

As an Emacs user of 30 years, all the vi[m] I've ever known or used is <ESC> :q!

(I'm aware that I could do :wq but I never need to.)

1

u/seeking-abyss Apr 02 '19

Harder to exit ed.

1

u/calrogman Apr 02 '19

It's literally easier to exit ed. You have to press 1 fewer buttons.

1

u/Chipazzo Apr 02 '19

This thread is hilarious. I’m a sys-admin that really only marginally knows python and maybe some js and doesn’t understand.that.funny(syntax) but prefers using VIM to write a bash script that’s less than 20 or so lines.

Also don’t forget:

G

$

G (n)

dd

1

u/nyxeka Apr 02 '19

I had to use vim once for some ssh command line file editting. It's not that bad once you get used to it.

1

u/[deleted] Apr 02 '19

I'm an old-school vi/vim user, and I love the editor. But every time I use it in a terminal these days I think to myself that the defaults are exactly wrong, especially autoindentation and select-copying.

1

u/redreaper99 Apr 02 '19

I wonder what they would think of exiting ex-mode in vim. I’ve seen vim veterans get confused with that one.

1

u/Dreamtrain Apr 02 '19

In contrast, in China, Korea and Japan the fraction going to this question is one-tenth as much. That might indicate that when developers in these countries enter Vim, they usually meant to do so, and they know how to get out of it.

My initial thought was that maybe they just don't get themselves into scenarios where vim is brought in your face, and the most common use case is probably where git makes you

1

u/phantomFalcon14 Apr 02 '19

What I don't remember having problems with exiting vim.

1

u/[deleted] Apr 02 '19

pkill -9 vim

1

u/_xsgb Apr 02 '19

After successfully quitted smoking, I was full of motivation and enthusiasm for quitting vim. But things are, It's... really hard to find a substitute offering the same level of satisfaction. So I just giving up for the moment.

1

u/ayyala Apr 02 '19

The post is from 2017.

1

u/bloody-albatross Apr 02 '19

source $VIMRUNTIME/mswin.vim

1

u/Rhed0x Apr 02 '19

The post is from 2017. Does this get posted every year now?

1

u/meshtron Apr 02 '19

I always use the lit up orange button on the power strip. Works great, changes do not persist but that's a good thing 99% of the time also.

1

u/excitebyke Apr 02 '19

Programmers: Making the same jokes Since the invention of the Vacuum Tube

1

u/javcasas Apr 03 '19

It's easy. You open a new console, and run `killall vim`

1

u/Eilai Apr 01 '19

And helping people exit Stack Overflow after passively aggressively telling people wanting to ask questions to fuck off.

2

u/happymellon Apr 02 '19

Closed as it is too vague.

Such a dick move, sometimes I don't know that is it too vague a subject, and closing without feedback helps no one, especially anyone that Google's that same question.

2

u/[deleted] Apr 02 '19

"Too vague" is not a close reason. You only get "Too broad" and "Unclear what you're asking".

1

u/Phrygue Apr 01 '19

Some day I'm going to download the vim source and patch it to ESC = quit. Or figure out what config files it has. Or actually use it instead of nano.

0

u/AstroNut88 Apr 02 '19

Sighs If I must...

What is Vim?

2

u/happymellon Apr 02 '19

Vi improved is one of the greatest text editors, that's been around for a very long time.

It's very fast for performing most actions since it is keyboard driven. The problem is that it acts differently to other editors in that it has two modes. You are dropped into a navigation mode when you first edit a file where most of the keys are for performing actions, and you are required to press a to append text or i to insert, for example.

Once in the editor mode it acts similar to other editors where typing inserts, overwrites and appends text depending on how you accessed the editor mode. You have to esc to go back to navigation mode, and to quit from navigation mode you have to type in :q, the colon being important as it tells vi that you want to type in a command rather than switching modes.

→ More replies (3)

-2

u/TheJack38 Apr 01 '19

Can confirm, I get stuck in Vim every single time I use it

7

u/cleeder Apr 01 '19

This speaks less about vim's complexity than it does your ability to retain learned information.

→ More replies (2)

1

u/icantthinkofone Apr 01 '19

Yeah, I was that drunk once.