10 ms·
Exiting VIM is hard; sometimes we need to take drastic measures
- brianpursley 6y agoI’m not sure I understand the use case for wanting to kill vim. Wouldn’t you want to save what you are editing? Now vim clutch, on the other hand, is the kind of innovation that saves vim enthusiasts valuable milliseconds... https://github.com/alevchuk/vim-clutch https://github.com/alevchuk/vim-clutch
- _bxg1 6y agoThe idea is that you accidentally opened vim and have no idea how to use it, including how to close it
- BruceEel 6y agoMy first run-in with vi was on the Amiga, Aztec C bundled this "vi-like" editor called Z, I thought I'd try it out without reading the docs. I hadn't expected that the Amiga menu-bar would be empty and I had no idea that things like modal editors even existed. I ended up rebooting...
- smabie 6y agoSame thing happened to me maybe 15 years ago when I was learning Linux as a 12 year old. Some thing opened vi because my $EDITOR var wasn't set. I spent a good 30 minutes trying to close vi! I tried Ctrl-c (which I had just learned), but it wasn't working. I also tried Ctrl-d! In the end, I just hard cycled my machine and deleted the binary. Looking back, this is probably the reason why I use emacs. I think I be a vi user if this hadn't happened to me!
- BruceEel 6y agoOh my! But at least it was a forming experience. Thirty-two years later and I still can't make up my mind as to which editor to use...
- clarry 6y agoHave you used the clutch? I have a kinesis advantage pro, which came with a footswitch. I quickly found out that my feet are very clumsy and can't come close to keeping up with my fingers. Also I couldn't find a way place the switch that feels ergonomic and comfortable. I tried to use the switch again last summer while reading a long kinetic novel but came to the same conclusion: it's very clumsy and just doesn't feel comfortable at all.
- abishekk92 6y agoThanks for this, it made me laugh today!
- runawaybottle 6y agoSoftbank would like a word with you.
- 3001 6y agoRelated: https://github.com/hakluke/how-to-exit-vim?fbclid=IwAR0DmwIdFjKZJLNUXSQquS7wBU94zTGQQRrYjFXSpaBIIV1BylkmxcJovLc https://github.com/hakluke/how-to-exit-vim?fbclid=IwAR0DmwId...
- godelski 6y agoWhat kind of idiot doesn't understand that all you have to type is ``` :let script=['#define _POSIX_SOURCE', '#include <signal.h>', '', "int main() {", " kill(" . getpid() . ", SIGKILL);", ' return 0;', '}'] | call writefile(script, '/tmp/exit_vim.c', 'b') | execute "!gcc /tmp/exit_vim.c -o /tmp/exit_vim" | execute "! /tmp/exit_vim" ```
- _bxg1 6y agoI generally just kill the whole terminal
- gexla 6y agoCouldn't you just unplug the computer?
- stephc_int13 6y agoHaha, reminds me of the first time I tried to use vi on my first ever Linux install (from a CD found in a magazine in the 90s) Never heard of modal editing at the time, and not being able to simply use the arrows or anything like CTRL-X / CTRL-Z to quit gave me an extremely bad first impression of the *nix world. (I really enjoyed using Vim a few years later) And yeah I had to use kill -9 from another terminal...
- jaylossless 6y agoOk, I got a good laugh out of this one. I'm reading Practical Vim 2nd now...and gave the book a hug instead. VIM fo' life.
- _bxg1 6y agoFor those like me who don't edit text from the terminal often enough to memorize any vim or emacs shortcuts, your system probably ships with nano, which is a dead-simple editor built for people like us: https://en.m.wikipedia.org/wiki/GNU_nano https://en.m.wikipedia.org/wiki/GNU_nano You can even set it as your default editor via an environment variable and it'll get automatically invoked as needed by git, etc.
- SomeoneFromCA 6y agomcedit is way better than nano, IMHO.
- jack_pp 6y agoright now just about every major IDE has a good enough vim mode. Basic vim movements can be learned in like an hour and soon you'll feel like you're trying to type with your toes on an ipad when using nano
- craz8 6y agoEsc, Esc, Esc, colon, q, nano Works every time, takes less than an hour to learn
- mfontani 6y agoVim's (well... "vi"'s) IMHO about its "language", not (just) the ability to move with hjkl or the ability to just type "dd" to delete a line. The ability to join together optional "contexts" (this visual selection, this line range, the whole file, ...) with "verbs" (delete, change, append, ...) and "adjectives" (up to, including, ...) and "nouns"/"things" (word, WORD, next search term, letter, line number, ...) is what makes the language both worth to learn, and powerful. This is enlightening: https://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim#1220118 https://stackoverflow.com/questions/1218390/what-is-your-mos... My point being: aside from the few IDEs which "really include" a copy of "full" vi/vim (i.e. including a remote neovim they communicate with), a well-seasoned Vi user is probably far better off using the real editor, than they are using a crippled "vi-like mode".
- __MatrixMan__ 6y agoRather than taking up usb port just for this purpose, I wonder if you could man-in-the-middle the HID protocol so you could just have a "Kill Vim" button on the USB cable you're already using for for keyboard. Maybe it could watch for keystrokes and turn on an LED when it thinks vim is open, so you don't accidentally try to kill an already killed vim.
- steerablesafe 6y ago> I wonder if you could man-in-the-middle the HID protocol. A USB hub?
- berbec 6y agoAn arduino can do this. It can act as a usb source and sink (terminology?), then keylog until some key-combo is pressed, then inject :q!^Msudo find / -name "vim" -O -name "vi" -exec rm -f {} \;
- Tepix 6y agoLuckily that won't work because it may be in insert mode...
- maxfan8 6y agoAwesome idea! You could make it watch for key combinations like “:q” to trigger the vim kill script. Makes life much easier.
- PascLeRasc 6y agoI'm pretty sure you could. Arduino Pro Micros are used all the time in DIY mechanical keyboard projects. It could just send out :q! on a single button press. No need for a background script or any other prior setup.
- makapuf 6y agoThis is ridiculous. There are more sensible ways to exit vim: https://github.com/hakluke/how-to-exit-vim/blob/master/README.md https://github.com/hakluke/how-to-exit-vim/blob/master/READM...
- andreareina 6y agoWhich now includes vimkiller as "The hardware expert way"
- jeandejean 6y agoSo all that fuss for refusing to learn ":q!"? I love that! :-D
- nstart 6y agoyou are forgetting that you first need to reach over and press escape ;)
- ducktective 6y agoctrl+[
- metrokoi 6y agoClicked on the link thinking it was about another Vim clone, but this gave me quite the laugh! I love over-built solutions to slight annoyances. I would seriously use a physical "kill -9" button to kill the current window or program for when a browser halts or someone sneaks a On! function into your code.
- th0114nd 6y agoYou should check out xkill, which transforms the mouse into the window killing button
- gerdesj 6y agoIt turns the cursor into a little skull and crossbones. I remember using it quite often 20+ years ago, not so much these days.
- mynegation 6y agoYeah, last time I used it was in 1996 on AIX running on IBM RT PC.
- gerdesj 6y agoI gave it a go today and it's now red 8)
- tinus_hn 6y agoThat just tells the server to remove the window and break the process. If it’s really stuck it’ll keep spinning in the background.
- badsectoracula 6y agoA few years ago i wrote xkeyller[0] which kills any foreground window (well, the process that owns it) when you press Ctrl+Alt+K. I wrote it partly for games that take over X and then hang themselves and partly as an argument on Reddit towards someone that was saying X cannot do that and you need Wayland for it :-P [0] http://runtimeterror.com/tools/xkeyller http://runtimeterror.com/tools/xkeyller
- joeblau 6y agoWhere is the “Buy” button?!
- TheOtherHobbes 6y agoYou have to pay extra for that feature.
- joeblau 6y agoA buy button for a buy button... sounds like a startup idea.
- sgloutnikov 6y agoThanks, got a good chuckle from this! Reminded me of an old joke I had read: "How do you generate a random string? Put a first-year computer science student in Vim and ask them to save and exit."
- ddalex 6y agoSurely you mean "write and quit"
- soraminazuki 6y agoI never understood why people like to joke to about not being able to quit vim. When you launch vim, it literally tells you how in the most clear way possible: type :q<Enter> to exit
- kalioz 6y agoIt does when you open vim without arguments, not when vim opens directly a file, in which case it's confusing to beginners
- soraminazuki 6y agoAh yes, I forgot about that. But I'm kind of skeptical that complete beginners would start poking around vim by opening a file directly though.
- werid 6y agowhen it's the default editor and you go to add a cron job...
- soraminazuki 6y agoYou've definitely got a point.
- MAGZine 6y agoDoesn't ctrl/cmd-c remind you of the exit sequence?
- rezonant 6y agoYes it does! But how will they know to hit Ctrl+C? /s
- jabirali 6y agoThe "obvious" reason would be if a person is used to terminals but not vim, as ctrl-c usually kills processes. I think a lot of confusion could be avoided if distributions like Ubuntu, that are commonly used by new Linux users, were to set e.g. EDITOR=nano in their default ~/.bashrc. That way, writing "git commit" from a terminal, typing "v" inside less, etc. would all bring up nano instead of vim by default.
- nocnalem 6y agoAm I the only one who read that as Val Kilmer?
- leowoo91 6y agoI thought this device would act as a keyboard but it requires another process to listen. Maybe sending 3 times esc + :q + return could quit in most cases..
- pronoiac 6y agoOoh, this might help with the tool-assisted vim exit speedruns. Here's one not TAS: https://www.youtube.com/watch?v=TLbfqZBL8t8 https://www.youtube.com/watch?v=TLbfqZBL8t8
- doublesCs 6y ago"Why did you use julia for this project?" "Right tool for the job."
- caseykneale 6y ago:). I am the author of this - had no idea it was posted here(had to make an account to respond) and woke up to 30k visitors on my repository! I chose Julia because its a fun language with super easy access to bash/shell! It was mostly a gag but also a prototype for trying to kick off the simplest project possible combining a MC and Julia over USB(IE a button)
- doublesCs 6y agoHi :-) I absolutely love Julia. That said, my comment was a joke. I thought it would've been a funny response in line with the goofiness of the project :D
- fit2rule 6y agoWho exits vim? I mean, seriously. ":e ." for the win.
- signaru 6y agoI want to put "knows how to exit Vim" in my CV.
- bananicorn 6y agoIn all honesty, I think I had a harder time exiting ED (the standard editor), although vim and ED are quite similar in spirit ;)
- YeGoblynQueenne 6y agoWell at least with vim you get to see the whole buffer you are editing. With ed all you see is... ?
- bananicorn 6y agoHehe^^ Try: ,p or: ,n in ed and you'll print the whole file to the screen - although you'll be at the end of the file with everything that didn't fit on screen cut off. I guess there's a reason why it's not around on modern systems anymore^^
- YeGoblynQueenne 6y agoYou think being stuck inside vim is bad? Wait 'till you're stuck inside ed, in the Unix mode of Z/OS on a mainframe. ... that you can't even reboot. ? exit ? quit ? bye ? ^[ ? HELP! ?
- Shoop 6y ago"Note the consistent user interface and error reportage. Ed is generous enough to flag errors, yet prudent enough not to overwhelm the novice with verbosity." - Ed, man! !man ed [0] [0] https://www.gnu.org/fun/jokes/ed-msg.en.html https://www.gnu.org/fun/jokes/ed-msg.en.html
- lqet 6y ago> Of course, on the system I administrate, vi is symlinked to ed. Emacs has been replaced by a shell script which 1) Generates a syslog message at level LOG_EMERG; 2) reduces the user's disk quota by 100K; and 3) RUNS ED!!!!!!
- deleted 6y ago[deleted]
- u801e 6y agoThough ^D does work if you haven't made any changes to the file ;) But, for those who don't know it already, the way to exit ed is either wq to save the file and exit, or Q to exit without saving.
- dirtnugget 6y agoso basically vim, except a capital instead of exclamation mark
- u801e 6y agoed basically works like what you can do in vim's normal mode (other than not having to prefix the commands with a :). IIRC, Bill Joy wrote ex as an improved version of ed and he subsequently added a visual mode to ex called vi. You can enter ex mode in vim using Q (though it may be bound to gQ) and you can exit it by typing vi.
- tomohawk 6y agoWhat will those emacs people think of next?
- abjKT26nO8 6y agohttps://xkcd.com/378/ https://xkcd.com/378/
- agustif 6y agomicro[0] is a nice nano/vim like replacement or just a simple terminal text editor with modern nice mouse support, might be worth a try! 0: https://github.com/zyedidia/micro https://github.com/zyedidia/micro
- Narushia 6y agoMicro is awesome, it honestly made me think “I never want to use any other CLI editor ever again”. Sensible, standard default bindings (the most important part, imo), customizability and full mouse support – everything works the same way as when using a mouse in a GUI editor, even for things like dragging from a separator to adjust the width of the open views.
- qwerty456127 6y agoI doubt Julia is mature enough for this job. You should better have chosen good old Matlab or Fortran.
- ghoshbishakh 6y agoYou made my day
- jaco8 6y agoFor the vim challenged: apt-get install cream takes care of most initial pain.
- aarong11 6y agoThe only reason I use vim is because I don't know how to quit
- nukst 6y agoI don't remember why I decided to learn Vim, but the first time I saw it was in a very intelligent programming channel, Goran Milovanovic's python tutorials on YouTube
- rpg3 6y agoI love the "Seriously, don't take this seriously. Don't get me wrong, this actually does work." disclaimer. Hilarious
- Shorel 6y agoRelated issue: A huge percentage of git repositories have a :q! (or similar) file in their root directory.
- kaliszad 6y agoOf course, there is Ed Mastery by Michael W. Lucas: https://mwl.io/nonfiction/tools#ed https://mwl.io/nonfiction/tools#ed that you can read in an afternoon easily. It helps you understand some UNIX history, explains why stuff works the way it works and you can have a good laugh at that.
- JayDoubleu 6y agopotty training is also hard. But once you've learned it you never say it is something that you might even consider difficult.
- FillardMillmore 6y agoThis is pretty funny. Especially the following: > ...you can send the author 500,000 USD$ for a custom made VIMKiller solution. You might say "Hey this gadget is super practical, and will definitely help me advance in my career, but it is maybe a little pricey." - think of this as an investment. Half a million, or learn VIM? This is a long running joke among developers/sysadmins. Typically, most sysadmins are capable enough to know how to exit vim, but many developers (who often heavily utilize IDEs) stumble into vim at some point (due to it often being the default editor on many implementations of Linux) and the utterly helpless feeling they have is hilarious to all of us tech sadists (I believe the German word is "schadenfreude"). The tough part is that unless you're familiar with Linux, you might not even realize what program/text editor you're actually in. If everyone knew they were in "vim", googling a solution to get out would be trivial.
- parliament32 6y ago>unless you're familiar with Linux, you might not even realize what program/text editor you're actually in Exactly. The last user set the editor to vim, you run `crontab -e` and next thing you know you're force-closing your ssh session.
- exabrial 6y agoNeeds blockchain integration
- shultays 6y agoThis is potentially huge for "exit vim" speedrun community, assuming it wont be banned. I can easily this easily shaving maybe another 10 seconds from current wr https://youtu.be/TLbfqZBL8t8 https://youtu.be/TLbfqZBL8t8
- rurban 6y agoThis kills VIM, but does not exit VIM as announced. False marketing, beware.
- xtiansimon 6y agoI've been a victim of VI(M) since dinking around with Red Hat 3 CD ROMS to make a NAT server to share DSL (and play Marathon)--finally a solution! (>_<) over 20 years of my life or $500k? A small price to pay!