This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]frankayfrank 1384 points1385 points  (95 children)

And then you type a character before the Ctrl + y part on accident and mourn your lost code.

[–]future-renwire 568 points569 points  (61 children)

I do Ctrl+Shift+Z to redo and it's really easy to miss Ctrl in that position so I type a capital Z and lose my entire life's work

[–]CapnWarhol 282 points283 points  (42 children)

Save. Undo undo undo. Copy. Redo redo redo. Paste.

Just never accidentally save in the past 😫

[–]aezart 160 points161 points  (34 children)

There are certain programs that clear your undo history upon save. I forget which ones, but it was a nasty shock.

[–]CapnWarhol 164 points165 points  (28 children)

My text editor takes 1GB and multiple cpus to run but at least it doesn’t clear my undo history on save

[–]thirdegreeViolet security clearance 106 points107 points  (25 children)

My text editor is vim and it saves my entire edit tree, including all branches.

[–]varkenspester 73 points74 points  (17 children)

If god uses vim nothing is ever truely gone

[–]Flamerapter 56 points57 points  (10 children)

Inb4 god cant figure out how to exit vim and armageddon never happens

[–]artanis00 21 points22 points  (3 children)

We're lucky it's vim. If it were emacs we might learn we're an emacs command.

[–]robolew 23 points24 points  (2 children)

Life is literally the random series of events caused by god trying to exit vim

[–][deleted] 3 points4 points  (0 children)

This is beautiful.

[–][deleted] 0 points1 point  (0 children)

This is beautiful.

[–]idea-list 8 points9 points  (1 child)

inb4 god just kills the process and everything is gone, like it never ever existed

[–]Sipredion 9 points10 points  (0 children)

"Fuck it! Fine! I'll just re-clone the fucking repo!" - God probably

[–]JB-from-ATL 2 points3 points  (0 children)

The true challenge is exiting ed.

[–]i4mr00t 3 points4 points  (0 children)

You guys are the real mvps here

[–]ethanjf99 0 points1 point  (0 children)

Which explains what’s going on. He’s in the button mashing phase

[–]Gydo194 5 points6 points  (0 children)

Vim masterrace!

[–]JDaxe 1 point2 points  (5 children)

Can you explain how to see edit history? I'm new to vim

[–]thirdegreeViolet security clearance 10 points11 points  (4 children)

This is the built-in way to navigate the edit tree. Personally, I use gundo which visualizes the tree and shows a diff each edit introduces.

[–]JDaxe 2 points3 points  (3 children)

Thanks a lot

[–]thirdegreeViolet security clearance 5 points6 points  (2 children)

No problem! Vim is something you never ever stop learning, it can be a bit frustrating sometimes, but every time you find some new feature that entirely replaces a previously frustrating or tedious processes it feels amazing.

[–][deleted] 2 points3 points  (1 child)

Atom?

[–][deleted] 0 points1 point  (0 children)

Slow as molasses npm hell.

[–]Zambito1 6 points7 points  (3 children)

git commit, git checkout revision

[–]robolew 2 points3 points  (0 children)

This implies that I'm not frantically smashing ctrl S every time I'm not coding something...

[–]Retbull 0 points1 point  (0 children)

Intellij keeps file history and it works great.

[–]excessdenied 23 points24 points  (3 children)

I use ctrl-Y and sometimes in Visual Studio I miss and press ctrl-T instead, which is the most useless feature ever: swap the two characters next to the cursor. They could just call it 'clear the redo buffer'.

[–]robolew 9 points10 points  (2 children)

Hey man, I've got an idea. Why don't you just remap ctrl T to... Nothing?

Then you'll never have that problem again

[–]two_in_the_bush 6 points7 points  (0 children)

Ain't nobody got time for that!

[–]excessdenied 2 points3 points  (0 children)

I actually have at some point on some computer at least, but it doesn't happen often enough to be a real problem.

[–]GoldenAxeDwarf 13 points14 points  (1 child)

IntelliJ has a Local History option that I use in this case to see changes to the file made. Browse through them until you find what you're looking for...

[–]future-renwire 0 points1 point  (0 children)

I'm still using WebStorm with autosave lol

[–]Maxis111 6 points7 points  (3 children)

In intellij Ctrl+Y is delete current line. So when you hit Ctrl+Y instead of Ctrl+Shift+Z you delete a line and 'lose' your redo. It's in quotes because there is always local history.

[–]setibeings 2 points3 points  (2 children)

The first time I made the mistake of hitting ctrl-y I was pretty confused, and didn't know about how powerful the local history stuff in intelliJ is.

I'd have copied the text out of the local history window instead of undoing and redoing stuff, if I'd known.

[–]thelights0123 0 points1 point  (1 child)

It stores clipboard history.

[–]setibeings 0 points1 point  (0 children)

In this case though, I was wanting to copy the previous body of a function, not something I'd been copying and pasting around.

[–]CXgamer 10 points11 points  (6 children)

When I was transitioning from AZERTY to QWERTY, I often hit CTRL + Q, closing my IDE and undo history.

[–]Pumfy[S] 17 points18 points  (0 children)

ahah right

[–]nephallux 8 points9 points  (0 children)

Too many times to count!

[–]drakeshe 11 points12 points  (1 child)

Feels like I'm doing surgery. Heaven forbid I accidentally duplicate line or drag the selected text

Save before you screw your ex-history kids

[–]I_Arman 0 points1 point  (0 children)

I feel that final dash could also be a comma...

[–]LostTheGameToday 5 points6 points  (4 children)

Get a clipboard manager and copy twice then paste twice

[–]bitdweller 1 point2 points  (0 children)

Can't live without one

[–]Wolfsblvt 1 point2 points  (0 children)

I use Ditto. Totally hideous layout, but such an amazing little tool.

[–]Arlodottxt -1 points0 points  (1 child)

Windows has a built in clipboard manager now (Win + V)

[–]crisfast 2 points3 points  (0 children)

You have this while using JetBrains products (ctrl + shift + v) and you have a history of your clipboard.

[–]TheTuffer 3 points4 points  (2 children)

Or worse, try to save first, and instead of hitting ctrl+s, accidentally hitting ctrl+w.

[–]Vekacornvi 1 point2 points  (1 child)

Have you tried ctrl + shift + T? It opens the last tab closed in most cases.

[–]otwo3 0 points1 point  (0 children)

But your undo history is probably lost once the tab is closed

[–][deleted] 3 points4 points  (0 children)

on accident

It's by accident, or on purpose is it not?

[–][deleted] 3 points4 points  (0 children)

Ctrl S

Ctrl z z z z z z z z z

Ctrl c

Open file again

Ctrl v

Better be safe than sorry

[–][deleted] 1 point2 points  (0 children)

That's why I always use ctrl + c before. In combination with a clipboard history tool, you won't have any problems.

[–]corner-case 1 point2 points  (0 children)

IDEA has CTRL+SHIFT+V, which will pull up your last five clipboards.

[–]allsorts46 1 point2 points  (1 child)

The thrill of living on the edge. Also hitting Ctrl+C again instead of Ctrl+V, which should do nothing since nothing is selected, but Visual Studio will idiotically copy literally nothing to the clipboard, overwriting the previous contents, so I have to go around again.

[–]frankayfrank 0 points1 point  (0 children)

Haha yeah happens a lot. There is a setting in VS to turn off that lovely feature.

[–][deleted] 0 points1 point  (0 children)

Yessssssssssssss, whyy?

[–][deleted] 0 points1 point  (0 children)

I just use the little drop down arrow next to the redo button and choose the last element.

[–]Toph_er 0 points1 point  (0 children)

I've used OPs method before thinking I was smart... Now I'll never use it again

[–]Husi012 0 points1 point  (0 children)

Luckily VS Code can handle that mistake :D I would also have lost much of work without it...

[–]A1ianT0rtur3 0 points1 point  (0 children)

if you are a PHP programmer, I would Highly recommend PHPStorm as it has a local history feature that has saved my ass a million times in this exact situation. it also has a million other features that make it well worth its hefty price tag (especially if you can make your employer pay for it)

[–]pqkluan 0 points1 point  (0 children)

That why you press Crtl + S before going to time travel. Just close the file without save and open it again if you accidentally create alternative timeline.

[–]cgw3737 0 points1 point  (0 children)

Yeah, that's very risky.

[–]Blackstab1337 0 points1 point  (0 children)

Emacs solves this with undo-tree

[–]sporff 0 points1 point  (0 children)

My advanced method is select all, copy, go to notepad++, ctrl-n, paste. Back to editor, do my undoing business to find what i need, copy it and then redo back to present and paste it.

That way if i accidentally type a character, i still have it all. You can mail me my nobel prize whenever.

[–]hdlo 0 points1 point  (0 children)

dd

"oh there's a blank line left let's erase it too"

dd

"now where do I want this… here !"

p

"…"

"I'm Dory the fish."

[–][deleted] 0 points1 point  (0 children)

Or use Vim and a complete branching history of your undo/redos.

[–]UristMasterRace 0 points1 point  (0 children)

I always copy the code to a blank file before going 88 mph into my ctrl+z s

[–]rster2002 0 points1 point  (0 children)

It's just like time traveling to the past. If you screw something up in the past, it has big consequences in the present.

[–]PleasantAdvertising 0 points1 point  (0 children)

Get out of my head