35 ms·
Because they are not very reasonable? * "dd" isn't reasonable because it violates the "command + movement/region" structure of vi commands. So is "cc" and "yy"
by xiaq 12y ago
Because they are not very reasonable?
* "dd" isn't reasonable because it violates the "command + movement/region" structure of vi commands. So is "cc" and "yy". None of "c d y" is not a movement or region. Presumably in this editor "_" represents the "whole line" region, which leads to also "c_" and "y_". Much more regular although it does require you to lift your finger one more time.
* "cw" isn't reasonable because "w" as a movement usually means "to the next word", but in "cw" it means "to the end of current word" instead. "ce" is indeed better.
* "r" is actually not bad (indeed "rx" is equivalent to "clx<Esc>", but the former requires 2 keystrokes), but I guess it's because the author rarely uses it.
Anyway the editor is pretty small, it might be easy or even fun to hack it! :)
- philh 12y agodd, cc and yy violate that pattern of vi commands, but they form their own pattern. (g~~ is another instance of it.) I agree that cw violates a pattern, but I think it's a reasonable violation. (Not necessarily good, but reasonable.
- dllthomas 12y agoGiven that you can get cw behavior with ce, I don't really think the original breaking of cw was reasonable (though I expect it went the other way and cw existed before vi settled into its current verb-noun philosophy). I agree with you on the doublings - probably makes most sense to preserve them.
- philh 12y agoThat is a reasonable argument against the existing cw behaviour. I consider this to be a reasonable argument in favour: when you delete a word, you probably also want to delete the space after it; when you change a word, you probably don't. There are reasonable arguments on both sides, and I don't think that the balance is overwhelmingly on either side, so I consider either choice to be reasonable. (In general, to show that something is unreasonable, you can't simply present arguments against it. You need to show that the arguments supporting it are weak.)
- dllthomas 12y agoI think that argument would be much stronger if forgoing deletion of the space was hard to do - but it's literally one key over. Further, it mucks with peoples' intuitions about what range w actually covers - something I'm only recently overcoming after 20+ years with vi and vim. Meanwhile, I have found myself in the position of wanting to delete the space and had no way to express it (as a single action that I can redo with .).
- gpvos 12y agoReasonable or not, dd and cw are wired into the fingers of almost every vi user, so they will indeed be a major turn-off for many. They are for me.
- unclebunkers 12y agoIt's a reasonable expectation, and they're reasonable shortcuts. They many not conform to as strict syntax as other vim shortcuts, but english doesn't conform to any of it's own rules and I doubt we would call it unreasonable. All language is an abstraction of modelling the worlds things and concepts into sound.
- dllthomas 12y ago'"cw" isn't reasonable because "w" as a movement usually means "to the next word", but in "cw" it means "to the end of current word" instead. "ce" is indeed better.' I've recently been noticing this - dw behaves like dw, but cw behaves like ce and there's no way to express a real cw in a short number of keystrokes. Despite it breaking my muscle memory, I believe I approve of this change.
- philh 12y ago> there's no way to express a real cw in a short number of keystrokes. dwi is pretty short.
- dllthomas 12y ago... but not a single action. This is important when I want to repeat things.
- 286c8cb04bda 12y ago> Presumably in this editor "_" represents the "whole line" region, which leads to also "c_" and "y_". That's not specific to this editor. In vim _ goes from the cursor to the end of the line (but does not include the newline at the end like $ does).
- mpu 12y agoThe reasons you cite are the reasons why it is that way. Concerning the 'c' command, I leave it that way until people are so annoyed that they have to dive in the code themselves, it is a kind of social experiment. I got used to not using it. I went through lots of thinking to make the code nice and clean and would like to see if it is indeed that way by having people modify it.