4 ms·
Semi-related: What I really wish all my editors and IDEs would have is some kind of "delete history" view into my deleted text (especially blocks of text). I'l
by quartz 4y ago
Semi-related: What I really wish all my editors and IDEs would have is some kind of "delete history" view into my deleted text (especially blocks of text).
I'll often delete something, then work for a while, then realize I need that thing back again so I have to VERY carefully undo everything after the delete until I get to a point in history before it, copy the deleted text, then re-do everything back to my original state while making sure not to accidentally execute any inputs which would burn down the redo stack.
- vvillena 4y agoJetbrains IDEs can do this using the local history feature. Browse through time on a separate tab, copy what you need, and paste it back into the present.
- Larrikin 4y agoWhats even more amazing is that you can right click the package/folder and get local history and see entire files that you previously deleted. Took me a while to discover this but has saved me almost as many times as local history in a file. Also makes me feel much better when refactoring and deleting tons of old code.
- headPoet 4y agoA lot of IDEs (I know Eclipse and VSCode both do this) will create a copy of the file you're working on each time you hit save. You can then navigate back through the local history of the file. I'm conditioned to hit Ctrl+S with almost every change, so this gives me a very detailed history of my revisions.
- lelanthran 4y agoVim stores all deleted text automatically, up to a max of 10, I think. Probably very possible to extend that with some advanced vimscripting.
- cpcallen 4y agoIn this thread: people discussing all the excellent features they wish their text editor had that emacs (and/or vim) has had for literally decades.
- JackFr 4y agoAnd/or JetBrains. Makes me wonder honestly what tool in widespread use doesn’t have this? Notepad?
- nouveaux 4y agoVim supports practically unlimited undo with branching history. You can visualize it and hop to any undo with a plugin. https://github.com/simnalamburt/vim-mundo https://github.com/simnalamburt/vim-mundo
- lelanthran 4y agoYes, but GP wanted something that would just keep all deleted text. Sort of, anytime you delete something, that text gets stored somewhere in case, 2 hours later, you realised you wanted it.
- quag 4y agoYes, vim’s “set undofile” will create a persistent undo file that stores all changes to the file indefinitely. You can undo changes made months ago over reboots. If you move the undo file between machines, you can undo on different computers. Undoing a change from 2 hours ago in the same editing session is the trivial use case for undofile.
- lelanthran 4y agoBut undoing is not what the original commenter wanted.
- 4y ago
- xixixao 4y agoYou can use “cut” instead of “delete” and clipboard with history tracking, for example Alfred on macOS. Then you cut, do some changes, and later on realize you wanted something from the cut code, bring out the clipboard history and fish out what you need.
- quartz 4y agoOh cool-- are you saying Alfred will let me override the delete key in the case of highlighted text so it always executes a cut instead?
- lyjackal 4y agoI think they’re just referring to a clipboard history offered by Alfred, not remapping the delete key
- tartoran 4y agoYes, but having thousands of snippets in a bucket can be quite confusing too, where do the pieces go back and so on. For this reason I comment out code then keep it until I’m sure I no longer need it. This works in sessions, and do the final delete, clean up etc at the end of the session before committing the changes to the repo. I see devs keeping commented out code in repos but that adds too much noise, makes the code a real mess..
- chrisshroba 4y agoMaccy is a great free and open source clipboard history tool with a nice interface (Alfred requires the power pack purchase for this feature)
- jorams 4y agoEmacs does this by default. Anything you delete ends up in the "kill ring", and you can cycle through that when pasting ("yanking") something. Packages like Consult[1] provide version of the yank-pop command that, instead of cycling through the kill ring, make it searchable. [1]: https://github.com/minad/consult https://github.com/minad/consult
- tezza 4y agoEclipse has “local history” for each file save operation. You can even do a graphical diff against each candidate timestamp in a gui wizard As others have mentioned JetBrains cloned this feature too
- sporedro 4y agoJust a list of tools that have this, in case you use any of them and didn’t know: Vim - has this with undo tree Emacs - has this as well Jetbrains - IDE’s have this with local history they show changes made. VScode has this I’m pretty sure by default otherwise there’s a plug-in for it since I remember doing it. Also just want to add something really cool about vim and undo/redos that relates to this post. With vim your able to “block” or “bunch” your changes which allows you to control what an undo will do. For example, going into insert mode and typing a sentence than exiting insert mode would be one “bunch” and undo would undo that entire sentence. If you wanted to you can control it by leaving insert mode after a adding a single word or making a single edit and that will be what the undo will revert. Probably rambling a bit here, but the concept of controlling what will be undone/redone is a really neat feature of vim.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]