News for hackers. Stuff that matters.
Re:Best of Vim Tips by jodrellblank on Wednesday June 25, 2014 @01:43PM (#7945562)
On 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.

Re:Best of Vim Tips by edwintorok on Wednesday June 25, 2014 @02:42PM (#7945937)
You 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.

Re:Best of Vim Tips by bch on Thursday June 26, 2014 @03:18AM (#7948482)
If it's important, I'm nearly always using version control which helps with direct or indirect fixing of misapplied actions.