Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"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


Clickable link for [1]

[1]: https://github.com/mbbill/undotree



Here's an alternative to vim-surround mentioned on r/vim:

https://github.com/machakann/vim-sandwich


> 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.


Kickass. 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: