Live data from Hacker News

How to Exit Vim

github.com

221–230 of 409 posts

Re: How to Exit Vim

#221

One of my Computer Science lecturers had a rule: use Vim for all development for his class whilst on campus, and if caught using any other editor/IDE – or committing any artifacts showing evidence of such – we would lose several percentage points from our final mark for his class. Harsh? Perhaps. But I can’t thank that lecturer enough for that rule. He converted a mostly IDE-wielding class into one that actually appr…

Had the same thing when I was studying CompSci. Ended up spending more time configuring vim than doing the work I was supposed to do. Even did the completely pointless exercise of making custom syntax highlighting for the pseudocode language we had to use.

This prepared you for the 'real world' better than any programming lessons could!

Re: How to Exit Vim

#222
post #97

I have the feeling something is missing on that list, but I can't put my finger on it ...

BRS, that old classic Big Red Switch, kills all known operating systems and proc's, dead in their tracks. Me, It's usually :wq, or sometimes :q! or more than likely ZZ - which can be done with shift zz or if you truly want to do it with just one finger, capslock then zz.

I never use :wq because I obsessively save after every thought.

Re: How to Exit Vim

#223
post #148
post #135

Jokes aside, shouldn't the page start with actually teaching how to quit vim? The page is considerably popular to show up on a Google search. I imagine the frustration of a beginner actually trying the first examples and not getting the joke immediately.

Yeah, I mean if you really wanted to help people exit Vim you'd trap Ctrl-c in command mode and print the instructions at the bottom of the screen. Something along the lines of "Type :qa and press to exit Vim" would probably do it...

You're only targetting old 1970s terminal users, there, though.

If you wanted to also help slightly more modern users who are used to CUA conventions from GUIs, you would have the [F1] key bring up some form of help screen, which said something like "Get out of Vim: Use :qa!" at the top.

Re: How to Exit Vim

#224

One of my Computer Science lecturers had a rule: use Vim for all development for his class whilst on campus, and if caught using any other editor/IDE – or committing any artifacts showing evidence of such – we would lose several percentage points from our final mark for his class. Harsh? Perhaps. But I can’t thank that lecturer enough for that rule. He converted a mostly IDE-wielding class into one that actually appr…

That's stupid and elitist. There's no reason to force students to go against IDEs that they're already used to, but also the general method of navigating around a computer which they're probably used to from MS Word etc.

If this was at work, or if this was for every class at a given university, I'd agree with you. But, in a place where you go to be challenged intellectually and open your mind, why not? This would be perfect if the same professor forces everybody to use a specific IDE in a different class...

Re: How to Exit Vim

#226
post #95

In the opposing vein, as an Emacs user the best configuration I ever made was to rebind C-x C-c to execute-extended-command instead of kill-emacs. It was way too easy to (even accidentally!) kill emacs with a sweep of a finger. And I probably use a few hundred execute-extended-command calls for each kill-emacs (which I now have to type manually as 'C-x C-c kill-emacs' - no problemo). A similar optimisation was with t…

  | However, I've been toying around with the idea
  | of eventually writing a minimal 'vi' clone that
  | you cannot exit. I'm sure there's pent-up demand
  | just waiting for one!
If a user space program can be truly unexitable without restarting (including the possibility of killing it through another shell, of course), then would you consider it to be a bug in the operating system? Seems a reasonable conclusion to me.

Re: How to Exit Vim

#227
post #90

Earlier quoted context omitted.

Nitpick: 'q' is an ed command. ('ed' Being the underlying line-editor upon which the original vi was layered.)

Why make it a nitpick and not a fun fact? :)

If it were a fun fact, it would have to point out that it is an ex command. Nitpicks do not have to be quite so factual. (-:

Re: How to Exit Vim

#228
post #85
post #53

Earlier quoted context omitted.

Ugh, ps|grep is unnecessary. Just use pgrep! Or even better, pkill -9 ;-)

pgrep is a good habit, it's on every major unix except perhaps aix. Most other constructions can backfire in some unexpected way.

Next you'll be telling people to use SIGHUP instead of SIGKILL. Or to use the PID. Or to get VIM to substitute its own PID into the ex command using getpid().

* https://mywiki.wooledge.org/ProcessManagement#The_risk_of_pa...

Re: How to Exit Vim

#230
post #156

It appears that the first bunch of methods don't account for graphical distributions of Vim, e.g. MacVim―which have a different executable name.

I suggest going to https://github.com/hakluke/how-to-exit-vim/issues and filing a bug report that sometimes one needs to type in a Scottish accent.
Post reply on HN