4 ms·
Vim has this, it's :earlier and :later https://vimtricks.com/p/vimtrick-time-travel-in-vim/ https://vimtricks.com/p/vimtrick-time-travel-in-vim/ :earlier
by Izkata 4y ago
Vim has this, it's :earlier and :later
https://vimtricks.com/p/vimtrick-time-travel-in-vim/ https://vimtricks.com/p/vimtrick-time-travel-in-vim/
:earlier 3 – Undo the last 3 changes
:earlier 5m – Go back to the state of the file 5 minutes ago
:later 2 – After undoing something, redo the next 2 changes
:later 1h – Travel forward through the change history 1 hour
Vim also stores the tree of changes, but it's a pain to access without plugins.
- bigfatfrock 4y agoUsing strictly vim for years, I'm still mind blown by the sheer amount of "don't knows" within the tool that I miss like this. Thank you!
- fnfontana 4y agoI have started to learn Vim about a year ago and still learning new tricks each day
- hackmiester 4y agoWait until you say this after 10 years.
- vintermann 4y agoAfter 10 years he might even be as fast as with a non-modal editor.
- Ar-Curunir 4y agoEvery non-modal editor I’ve used is significantly slower at editing text than Vim
- vintermann 4y agoWe have been through this argument many times. Here's Tog at Apple in 1989: https://www.asktog.com/TOI/toi06KeyboardVMouse1.html https://www.asktog.com/TOI/toi06KeyboardVMouse1.html And even then, it was old news. There was behavioural research in the 70s, the same kind that was used for designing cockpits (and which saved lives), showing that modal interfaces were undesirable. It can well be that you're a god with vim. But odds are, then, that you could have been a god with modern CUA-derived interfaces too (or with Emacs) if you'd put similar effort into it.
- ejstronge 4y agoSupposedly this article has been mis-cited of late and the keyboard shortcuts / mouse shortcuts of yore are distinct from what we have today. I can't find recent links but I'll offer the general advice that words used in the 70s do not necessarily have the same connotations they carry today. EDIT: here's an HN discussion https://news.ycombinator.com/item?id=28067729 https://news.ycombinator.com/item?id=28067729
- NateEag 4y agoDid you misspell "editor with language intelligence?" Because yeah, vim won't beat IntelliJ, but you can get it to be pretty decent with LSP: https://github.com/prabirshrestha/vim-lsp https://github.com/prabirshrestha/vim-lsp
- hackmiester 4y agoI use vim exclusively, and I laughed, because you are sort of right.
- pletnes 4y agoI’m at 15 soon.
- aidenn0 4y ago25, with 5 years of other vi editors previous to that. Vim is pretty great.
- deadlocked 4y ago20 and I only discovered :vsplit/:hsplit this year.
- jancsika 4y agoWhat a great feature! Is the author of that feature here? If so, I want to know how they could develop such a feature and be so quiet about it. It's like someone baking a birthday cake and then dropping it down an abandoned well. Just imagine how much more productive we'd all be if Vim bros were as loud as the crypto bros over the past decade!
- Avshalom 4y agoIt's at least 16 years old https://github.com/vim/vim/blob/1f4d4de1ba52d0a9f1310e1026d99adb2e9577b2/runtime/doc/undo.txt https://github.com/vim/vim/blob/1f4d4de1ba52d0a9f1310e1026d9...
- jancsika 4y agoAnd in that 16 years, where was the Vim-sponsored nascar with ":earlier 39" printed on the hood in Courier New? Shameful. (I'm actually afraid to continue making jokes on the non-zero probability that someone here reads this and tries to start a Vimcoin...)
- TheRealPomax 4y agoYou just need to get vim bros going. Just go "omg I hate vi so much" at a tech meetup and sit back for the fire hose of vim features to start.
- taneq 4y agoIt's like Cunningham's Law but with vim commands.
- kzrdude 4y agoAnother great Vim feature is persistent undo. You open a file, make modifications, save and close. You open again and the undo history is still there. You'll just have to enable that feature.. don't think it's on by default, unfortunately. Find a ~/.cache directory to store the undo history in.
- omoikane 4y agoCame here to look for comments about VIM's `g-` and `g+` feature, was not disappointed :)
- dm319 4y agoAre those the shortcuts for it? I can't believe I didn't realise vim had this.
- TylerE 4y agoWait until you see what intellij can do. It can do that, while also layering it in a logical, graphical diff viewer
- squeaky-clean 4y agoVisual Studio Code offers something similar in the timeline view. It's not as fine-grained, but still can be a life saver.
- nequo 4y agoI don’t doubt that IntelliJ overall is more user-friendly. But just to note, Emacs’ undo-tree can also show the diff for each change. Edit: Screenshot (with an unusually blue Emacs theme): https://www.emacswiki.org/emacs/UndoTree#h5o-5 https://www.emacswiki.org/emacs/UndoTree#h5o-5
- Lio 4y agoVim has plugins for that. ;) I use https://github.com/mbbill/undotree https://github.com/mbbill/undotree but if that's not to your taste there are many others. e.g. https://docs.stevelosh.com/gundo.vim/ https://docs.stevelosh.com/gundo.vim/
- HellsMaddy 4y agoI rarely have to use it, but Undotree is so amazing when you need it.
- semi-extrinsic 4y agoF** right off. How have I used Vim for fifteen years and not learned about this.
- Lio 4y agoHaha, that made me spit my drink. :D
- shepherdjerred 4y ago
- chrisshroba 4y agoI think what vim has is different and better than what OP describes - it's two separate change logs, one for undo/redo and one for time-based jumping. Trying to fit both of those constructs into one list gets messy.