4 ms·
"The vim-surround plugin is so useful that it should probably be built into Vim." I couldn't agree with this more. Also undotree [1] should be built into Vim a
by shabbyrobe 9y ago
"The vim-surround plugin is so useful that it should probably be built into Vim."
I couldn't agree with this more. Also undotree [1] should be built into Vim as well. Vim represents undo/redo under the hood as a tree, which is absolutely incredible once you have a plugin that unlocks it, but the built-in facilities for traversing that tree could be charitably described as "dismal".
Vim's undo tree makes a solved problem out of the old "undo undo undo undo undo... ok what did this file used to look like... redo redo y... oops did I just press 'y' by accident instead of redo and blow away a bunch of my later edits... next time I should remember to commit before I do that (even though I totally won't)" situation, but without the plugin, it's effectively inaccessible.
[1] https://github.com/mbbill/undotree
- brazzledazzle 9y agoKickass. Thanks for pointing out undotree. I had no idea it worked that way under the hood. This will certainly help me with bad habits I probably wasn't going to kick anyway.
- unkown-unknowns 9y agoClickable link for [1] [1]: https://github.com/mbbill/undotree https://github.com/mbbill/undotree
- dmix 9y agoAnd https://github.com/tpope/vim-surround https://github.com/tpope/vim-surround
- Spiritus 9y agoHere's an alternative to vim-surround mentioned on r/vim: https://github.com/machakann/vim-sandwich https://github.com/machakann/vim-sandwich
- roryokane 9y ago> without the plugin, it's effectively inaccessible I wouldn't say that. Plain Vim does have the `:earlier` and `:later` commands, which aren’t too hard to use in the case you described. For example, `:earlier 40sec` takes you to the state of the file as you saw it 40 seconds ago, no matter where in the undo tree you are or were. I agree that undo-tree is usually easier to use, though.