4 ms·
Great post, thanks for writing it. Since you mentioned you're using vim keybinding yourself, I thought I'd mention that any time you type x$ (where x stands fo
by tsm 12y ago
Great post, thanks for writing it.
Since you mentioned you're using vim keybinding yourself, I thought I'd mention that any time you type x$ (where x stands for delete, change, yank, etc), it's better expressed as X[1]. You mentioned c$, but C is the same thing.
[1] - Vim actually breaks this pattern on y—Y is the same as yy out of the box. But almost every vimrc I've seen remaps Y to y$ for consistency.
- a3n 12y agoIf I understand, your statement that X is better than x$ is based on keystrokes. But there are other ways to look at that. x$ is more consistent with the general idea of verb object. If part of your memorized subset of Vim includes xiw (do x In Word), xe (do x to the End of the current word), x) (do x to the end of the current sentence), etc, then x$ fits in with that. In fact for this reason (not consciously decided), I almost never use X variants. For me personally, there is also less wrist-twisting if I don't use X, which involves moving my pinky down to the shift key; that always feels like I'm walking up to the edge of carpal tunnel. But bottom line, none of those and similar choices are objectively superior to the others. What matters most is how much of what you do can be done with no conscious thought, that it just happens. The best parts of vim for me are the ones I no longer know how to do, the ones that are in muscle memory and that I have to stop and think about after someone asks "how did you do that?" From that point of view, YVSANMVSBYVSAOK[1]. [1] Your Vim Strokes Are Not My Vim Strokes But Your Vim Strokes Are OK.
- jonas_maj 12y ago> For me personally, there is also less wrist-twisting if I don't use X, which involves moving my pinky down to the shift key; that always feels like I'm walking up to the edge of carpal tunnel. But you have to press the shift-key for $ anyway. So with X, your typing Shift + X. With x$, you're typing x + Shift + $
- Ar-Curunir 12y agoHmm, wouldn't you have to use the shift key anyway for the $ part of c$?
- a3n 12y agoHmm, you're right. Just goes to show that I don't think much about what I do in Vim. :) But the consistency of combining known verbs with known objects still holds. If I know a verb I can operate on any object. If I know an object (motion) I can use any operator on it.
- StevePerkins 12y agoWow, thanks! This is exactly what I'm talking about, with organic learning over time. Just about every week, I pick up some little tidbit like this, which makes my editing flow a little bit smoother than it was the week before. I doubt that I'll ever know EVERYTHING, and that's okay.