4 ms·
Vim, keybindings and composability: https://medium.com/@mkozlows/why-atom-cant-replace-vim-433852f4b4d1 https://medium.com/@mkozlows/why-atom-cant-replace-vim-4
by edwintorok 12y ago
Vim, keybindings and composability: https://medium.com/@mkozlows/why-atom-cant-replace-vim-433852f4b4d1 https://medium.com/@mkozlows/why-atom-cant-replace-vim-43385...
- scrollaway 12y agoYes, I know the article and wholeheartedly agree with it.
- geertj 12y agoIn addition to composability, which I agree is a big idea, I believe there's another big idea in Vim: modal editing.
- jodrellblank 12y agoOn paper this works perfectly, in reality it doesn't. A lot like Regexes. The first n attempts at a regex always fail, and fail for human reasons - I didn't spot that the pattern I'm matching on actually appears earlier in the writing, the pattern has a typo but I spelled it correctly, the pattern used a unicode character that looked like an apostrophe, etc. And Vim composability suffers in exactly the same way. "Delete back eight words" works on paper, but eight words isn't a thing you can glance at, it means stopping and counting - especially not if it goes back over a linewrap. And does what about the word boundaries? If the cursor is in the word, at the end, at the start but still has to cross the word boundary to get to the previous word? Combined with that, the way Vim commands have instant and unbounded effects means that the wrong command or a misspress of a key, and suddenly there's a huge change to the text and you don't know what happened. This leads to the effect where even if a change looks right, if it was a big change ("add a comma to every line just before the last word") needs a lot of careful verification to make sure it worked as intended. In real world use, almost everything I try to do in Vim outside the everyday patterns of habit, takes enormously longer, works less well, is more fiddly and stressful, than 'just' doing it by hand or in Python.
- edwintorok 12y agoYou can get sort of a preview by going into visual mode with 'v' and then typing in the motion command, and once you are happy with what was selected you delete the visually selected text. I agree that its not very consistent here, because for a regex replace you would use a /c instead to get confirmation. Regarding the 'I pressed the wrong key' problem there is undo (and if you enable undofile you can undo even after saving or reopening the file), and there is git history. Having said that I agree that there are often situations where automating something (or using a more complex Vim command) would take more time than doing it by hand.
- bch 12y agoIf it's important, I'm nearly always using version control which helps with direct or indirect fixing of misapplied actions.