Live data from Hacker News

How to Exit Vim

github.com

211–220 of 409 posts

Re: How to Exit Vim

#211

I was on a remote system and remember I couldn't exit vi. What did I do? Well, I opened a second ssh session, looked up the process id with ps and killed it. This is so many decades ago ... like the very beginning of my curiosity when it comes to IT basically. Thinking back to it, I wonder how I was able to use ssh and tools like grep, ps and kill but did not know how to operate basic vi ...

>Thinking back to it, I wonder how I was able to use ssh and tools like grep, ps and kill but did not know how to operate basic vi ...

This has become a recurring thing for me to the point where I sometimes feel like I'm not as intelligent as I used to be. I'll need to look at requirements around older existing code, so I use git blame to see the commit history. It occasionally leads to me to some older code that I had written, and sometimes I marvel at how I was able to figure out or troubleshoot the issue.

One of the earliest examples in my professional career is using Threads. I had an academic understanding of threads. My practical knowledge around them was dubious at best. With the help of Stack Overflow and lots of web searching, I cobbled together a thread manager that can spawn separate threads for asynchronous web requests and kill a web request after X amount of time. I even made sure that error handling redirected gracefully should one of those threads get killed. That code (with no changes to the core functionality) still exists to this day.

Re: How to Exit Vim

#212
post #98

Earlier quoted context omitted.

Better they ruin their own soul than inflict upon others is the way to look at that. But then, what type of people don't RTFM besides the whole generation that treat google as their manual and when the internets down, so is there `knowledge` /s.

RTFM clearly does not apply because you can't read it if you're in vim and can't exit ;)

:h or failing that, the tried and trusted :!man vim

Though I'm wondering how many have discovered the first one with some frantic help me after typing the : and got there by accident.

Oh you can apparently just hit F1 in vim, wow.

Re: How to Exit Vim

#213
post #204

Earlier quoted context omitted.

Emacs is so dynamic and easily configurable, that people can actually rebind a lot of things when their colleague go to the bathroom as a prank. Just open a scratch file, enter some s-expressions, evaluate them, then kill the buffer.

The last time I went to the bathroom as a prank HR had to have another talk with me.

Never go to the bathroom as a prank.

Re: How to Exit Vim

#214
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…

Nice.

I did something similar w/ tmux: map the prefix key to C-a and map CapsLock key to Ctrl (never found real use for it). So Ctrl-a (actually CapsLock-a) is very ergonomically pleasant.

Re: How to Exit Vim

#215
post #207

Earlier quoted context omitted.

:x

Thank you. I swear every time I see a tutorial where someone is using vim they say to save and close with :wq and it drives me nuts.

That is because it is easier to teach as x you will associate with exit, though wq is write quite, but more so if you just want to save without exit you logically understand to just use w and from that you start to think - could I do :q, why yes you can if nothing changed and if so it will tell you.

But stressing how people exit vi is like stressing about people's fashion, just not worth it. If anything, have a private laugh at them to yourself and use that to remove other stress as more than enough stress in life, more so IT without seeking it out.

Re: How to Exit Vim

#220
post #137

Earlier quoted context omitted.

I would prefer a functional approach and formal verification so we can know for sure it will exit.

But who would support it? While a formally verified functional approach may satisfy one's doctorate requirements, the author will graduate and move onto blockchain development, leaving behind an exit-vim code base that no other engineer could possibly understand without the equivalent training. Upon receiving said training, an engineer would also take newly acquired doctorate and also move onto blockchain development…

This hits so close to home.
Post reply on HN