7 ms·
This is also quite an important difference: > Kakoune’s grammar is object followed by verb, combined with instantaneous feedback, that means you always see the
by laurent123456 10y ago
This is also quite an important difference:
> Kakoune’s grammar is object followed by verb, combined with instantaneous feedback, that means you always see the current object (In Kakoune we call that the selection) before you apply your change, which allows you to correct errors on the go.
- OskarS 10y agoI'm thinking about whether this is a good idea. He gets vi/Vim's model slightly wrong by saying it's "verb then object". While that is true for some things (i.e. text objects, like "ciw" for "change inner word"), it's not true in general. The general rule is "verb then motion". In "dw" ("delete word"), the "w" doesn't represent an object, it represents a motion (going one word forward). It's the same motion that I can use for any command, mapping, or indeed for just moving through text. Let say I want to delete a word from somewhere in the middle of a line. I would then navigate to the line in question, then press something like "^wwwdw" (i.e. "move to the beginning of the line, move 3 words forwards, delete word"). The motion of the deletion is the same as the motion for navigation. How would that work if the motion comes first? Would I go "wwwwd"? Would that delete one word, or four? Would you use a different key for the motion and the text object? I don't think this is a bad idea, swapping the order. The thing about showing you what's about to happen is a great point (though Visual mode in vim works pretty well for this purpose). I'm just wondering if it's better in practice. I'm certainly willing to give it a shot.
- omtose 10y ago>How would that work if the motion comes first? Would I go "wwwwd"? Would that delete one word, or four? 'w' will move the current selection to the next word so only one word. To extend the selection you need to press 'W' so "wWWWd" will delete four words. For most motions (if not all), the uppercase variant will extend the current selection. This also makes searching slightly different: / search forwards ? extend selection forward <a-/> search backwards <a-?> extend selection backwards
- OskarS 10y agoCan you add counts to motions/objects? I.e. does "3w" select three words you can act on, or do you have to go "wWW"?
- huac 10y ago3w works
- Phlogistique 10y agoas well as 3W, for a different purpose
- sullyj3 10y agow irritates me, because it always traverses a bunch of miscellaneous symbols, and my brain can't parse fast enough to easily tell in advance how many times I'll have to press w in order to get where I want. Extremely minor, but extremely niggly annoyance. I've found myself using https://github.com/justinmk/vim-sneak https://github.com/justinmk/vim-sneak more and more often.
- flukus 10y agoYou might also like quick-scope: https://github.com/unblevable/quick-scope https://github.com/unblevable/quick-scope
- flukus 10y ago> How would that work if the motion comes first? Would I go "wwwwd"? Would that delete one word, or four? Would you use a different key for the motion and the text object? I think you've hit the nail on the head here. c3w in vim is 3Wc in kakoune, 3wc will change the third word, straight off the bat there's a lot more shift key hitting. The most annoying thing though is getting the motion wrong, if 3W turns out to not be the motion I want, hitting escape does not return the cursor to where it was before the motion.
- sevensor 10y agoI often use visual selection mode in vim so that I can see what I'm about to operate on. For instance, if I want to change text between the cursor and the next match of a regex, I want to see the selection before I change it. So instead of c/re[enter], I type v/re[enter]c. It's one extra character, but it saves me a lot of headaches. This is the first I've heard of Kakoune, but I'm definitely intrigued.
- sevensor 10y agoProbably too late for anybody to see this comment, but I'd just like to drop back in and say I've tried it and it's amazing. I really did not expect that another text editor would be able to improve on Vim on basically all fronts, but kak has done it.