8 ms·
It literally everytime you boot the first screen tells you how to quit and get help. So..read the screen that comes up Everytime? If you try Ctrl c it tells you
by vopi 9y ago
It literally everytime you boot the first screen tells you how to quit and get help. So..read the screen that comes up Everytime? If you try Ctrl c it tells you it's :q.
- jayflux 9y ago> developers are often dropped into Vim from a git command or another situation where they didn’t expect to be, and they run into it infrequently enough to forget how they solved it last time. So the first screen doesn't help in this situation The sort of developers who get stuck in Vim are not the ones who are using it intentionally
- signal11 9y agoHitting Ctrl+C still works, it tells you to type ":quit<Enter>".
- masklinn 9y agoWhy doesn't it just quit? That's as stupid as Python's >>> quit Use quit() or Ctrl-D (i.e. EOF) to exit The software knows perfectly well what I'm trying to do FFS.
- Macha 9y agoSo it actually doesn't, it's basically just a hack around the fact that the repl is basically: while True: print(str(eval(input()))) Case in point: >>> x = str(quit) >>> x 'Use quit() or Ctrl-Z plus Return to exit' I suppose you could implement quit.__str__ as sys.exit(0), if you really wanted to avoid this problem.
- masklinn 9y ago> So it actually doesn't It does, it just does not care. > it's basically just a hack around the fact that the repl is basically: I know what a REPL is. Here's an idea: it's not difficult to add an exit special case to the REPL. > Case in point: Case in point: the developers added a "help text" to tell users to go fuck themselves, knowing exactly what users wanted to do and refusing to do it. quit's repr didn't appear by magic, it was put there, knowingly, by people who understood exactly what they were doing.
- monknomo 9y agoHumane programming is something I wish compiler and language builders would do more of
- marvin 9y agoApproximately 50% of the contributors in this thread argue actively against it, so I wouldn't hold my breath ;)
- monknomo 9y agoThat was not lost on me. They're wrong, and kinda mean TBH, but someday someone will make a pretty good language, with a really helpful compiler/interpreter and will have the viral-fu to get it in use
- pishpash 9y agoIt's insidiously more malevolent than that, considering how much productivity is wasted.
- sbmassey 9y agoquit is not a piece of repl functionality, it is a python function that will exit the repl when called, with a string representation that gives that message. If I set quit = 1, or if I define my own quit() function, I don't want to have to be continually fighting the repl in order to inspect its value.
- thoth 9y agoWhatever logic currently used to print the 'Use quit() or Ctrl-Z plus Return to exit' message could also... quit the REPL in the first place, right? I don't program Python much but do its users constantly type "quit" but not actually want to quit such that the REPL special cases this situation?
- masklinn 9y ago> Whatever logic currently used to print the 'Use quit() or Ctrl-Z plus Return to exit' message could also... quit the REPL in the first place, right? That one would probably be somewhat risky actually, that message is the "repr" of the quit object/function, displaying results at the repl invokes repr… but so does printing most containers, so e.g. `vars(__builtins__)` (to get a quick list of the builtins) would also quit the repl, which would be undesirable.
- wcoenen 9y agoThere is no special logic behind it. It just prints the value of the variable with the name "quit", the same way it would print the value of the variable "foo" if you typed "foo".
- khedoros1 9y agoThe repl's basically supposed to help you write a program by matching the behavior of Python itself. What if I've got a variable called "quit" and I want to check its value? The repl treats it specially because "quit", taken out of the context of the repl, makes sense as something to type in when trying to quit an unfamiliar program, not because actual Python programmers are likely to type it often.
- StavrosK 9y agoBecause it's an editor, and if it just quit on me every time I mistyped Ctrl-C just because you can't be bothered to type the right command, I would be quite angry.
- scrollaway 9y agoMy GUI editors quit on me every time I mistype Ctrl+Q. I don't really see the difference.
- root_axis 9y agoRight... I think the point is that this behavior is not preferable.
- chipotle_coyote 9y agoI would think that in both the ^Q and ^C case, the editor in question is capable of prompting "Really exit? (Y/n)" or something to that effect.
- bdamm 9y agoSince I switch between Mac OS X, Windows, and Linux hosts, accidentally typing ctrl-c when I meant to type cmd-c (copy outside of Terminal) isn't such an infrequent error. I'm thankful that ctrl-c isn't mapped to quit without saving.
- Piskvorrr 9y agoI do consider that a misfeature, especially since Ctrl+W and Ctrl+A are one key away and often carry commonly-used commands.
- khedoros1 9y agoWell, and my GUI editors don't respond to single-letter commands. It would violate my expectations of their UIs if they did. Similarly, in vim, I expect ctrl+q to send an XON signal to my terminal emulator...not to quit my editor. They're different programs with different UI conventions. I don't expect them to act the same. And I especially don't expect vim to change, after having 25 years of its own precedent and an additional 16 through vi.
- dllthomas 9y agoIn both cases, the program doesn't know what you're trying to do. It knows what you're probably trying to do. That's not enough. In both cases, this is because there's a race condition: If you run a command and decide you want to kill it, you use ctrl-c. If the command finishes between you deciding to kill the command and the signal being sent, the "container" process (vim or python) receives the ctrl-c. If it always assumes "what you want" is to exit, you've maybe lost work - edits made or variables populated. Avoiding that is definitely the right call!
- Asooka 9y agoPlenty of good reasons for ^C not to quit, mostly having to do with the rest of the Vim interface. Off the top of my head, first ^C is for cancelling actions, second ^C is very close to ^V, which is used for block-select, and very close to ^X, which is used for auto-completion, and very close to ^D, which is page-down, and quitting by mistake would be super frustrating. I think in this case vi's authors (and by extension vim's author) have picked the right choice of catering to the actual users, rather than being friendly to people who run the editor by mistake. At least they try to tell you "type :quit and press enter to exit".
- theandrewbailey 9y agoIf I expect Ctrl+C to quit immediately, and it doesn't quit immediately, that is not functionality that works.
- manyxcxi 9y agoWhat if you're normally a Windows user and you pressed CTRL+C trying to copy something out of the terminal? You haven't written to disk in a while, and then poof. Muscle memory can be a real pain some times.
- adambyrtek 9y agoYou might expect it to quit immediately, but most Vim users don't (for example I have a habit of using Ctrl-C to exit insert mode). When you travel to a foreign country you shouldn't expect everybody to speak your language.
- noir_lord 9y agoI got dropped into vim the other day (fortunately I used to be a vim user) unexpectedly. Had switched from Ubuntu to Fedora and it turns out that vim was the default git editor not nano (until I switched it anyway).
- dsp1234 9y agodev: That just typed ':q' into the text area me: Hit escape first, then :q dev: Oh, then why doesn't say escape then :q me: welp
- eridius 9y agoCute, but no. When you enter insert mode, the "welcome screen" disappears. So if you can see the instruction telling you to type ':quit', then typing :quit will work.
- dsp1234 9y agoFTA, https://zgab33vy595fw5zq-zippykid.netdna-ssl.com/wp-content/uploads/2017/05/exitvim-1024x455.png https://zgab33vy595fw5zq-zippykid.netdna-ssl.com/wp-content/... It happens because people don't what they are doing. You assume that they hit ctrl+c, then immediately type :quit, but if they did, then they wouldn't be Googling it. They did something between trying to exit and quit that got them into a different mode.
- FreeFull 9y agoPerhaps they miss the : Without it, you end up recording a macro and going into insert mode.
- eridius 9y agoI'm not assuming they're hitting Ctrl+C. What I'm saying is the screen that says VIM - Vi IMproved version 8.0.567 by Bram Moolenaar et al. Vim is open source and freely distributable Sponsor Vim development! type :help sponsor<Enter> for information type :q<Enter> to exit type :help<Enter> or <F1> for on-line help type :help macvim<Enter> for MacVim help disappears as soon as you enter insert mode (or really interact with Vim at all). If you're in insert mode, you don't see this. So if you see this, typing :quit will work.
- a3n 9y agovim myfile.txt opens myfile.txt, and literally does not show the splash screen.
- masklinn 9y agoAnd worse vim is often the default EDITOR or software's fallback in case no EDITOR is set, so you get dropped into a vim edition buffer seemingly randomly.
- fishywang 9y agoI'm pretty sure that I've never seen any OS/Linux distribution set default EDITOR to vim. If EDITOR is set to vim, then someone must intentionally did that.
- theandrewbailey 9y agoThat's the point. That behavior is contrary to the expectation. Ctrl+C should not display a message: Ctrl+C should quit immediately.
- bryanlarsen 9y agoOn many editors ctrl-c is the copy key. Not a good key to exit on...
- kpil 9y agoIt's the other way around - mapping copy to ctrl-c was a bit stupid...
- slrz 9y agoYep. Apple got this one right with the Cmd key. Much saner than the context-dependent hijacking of the control key with its long-established conventional usage.
- bryanlarsen 9y agoVery true, but that argument was lost over 20 years ago.
- chrisweekly 9y agoCTL-C, or CMD-C?
- brewdad 9y agoComing from the Windows world, I am happy that Ctrl+C doesn't make assumptions and quit. Imagine attempting to copy something and having your file close without warning.
- ygra 9y agoYou can intercept Ctrl+C on Windows just as well and do nothing, or something different than quitting.