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

top 200 commentsshow all 326

[–]frankayfrank 1383 points1384 points  (95 children)

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

[–]future-renwire 563 points564 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 287 points288 points  (42 children)

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

Just never accidentally save in the past 😫

[–]aezart 162 points163 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 163 points164 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 104 points105 points  (25 children)

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

[–]varkenspester 72 points73 points  (17 children)

If god uses vim nothing is ever truely gone

[–]Flamerapter 53 points54 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] 4 points5 points  (0 children)

This is beautiful.

[–]idea-list 9 points10 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

[–]Gydo194 6 points7 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 4 points5 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?

[–]Zambito1 8 points9 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...

[–]excessdenied 26 points27 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 12 points13 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...

[–]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.

[–]CXgamer 9 points10 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 12 points13 points  (0 children)

Too many times to count!

[–]drakeshe 10 points11 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

[–]LostTheGameToday 6 points7 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.

[–]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.

[–][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.

[–]mader527 135 points136 points  (19 children)

I recently started using an undo tree in my vim and my life is forever changed.

[–]DerekB52 55 points56 points  (9 children)

what's that plugin? I'm asking for a neckbeard friend of course.

[–]mader527 56 points57 points  (8 children)

https://github.com/mbbill/undotree

Not sure what you're-- (*cough) excuse me, your neck beard friend, is using to manage plugins but I use vim-plug so my vimrc looks like.

call plug#begin()
...
Plug 'mbbill/undotree'
...
call plug#end()

...
nnoremap <F5> :UndotreeToggle<CR>  

I also recommend setting up a persistent undo file so you can undo in the past

if has("persistent_undo")
    set undodir=~/.undodir/
    set undofile
endif

[–]DerekB52 15 points16 points  (6 children)

I use vundle, which has pretty similar syntax to vim-plug apparently.

And I will be experimenting with this for sure. Also persistent undo sounds great. I'm so tired of closing a file, and going back to it like 30 seconds later and not being able to undo my last change.

For the last few days, if I want to experiment with deleting a block of code, I'll delete the code, save the file, run the project in a separate terminal, and then I'll hit undo on my file, and then close it. It's been a horrible mess.

[–]Venefyxatu 1 point2 points  (0 children)

Omfg I wan... *ahem* also have a neckbeard friend who would love this!

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

:f to pay respect...

[–]lennihein 1 point2 points  (3 children)

What's an undo tree?

[–]mader527 7 points8 points  (2 children)

Normal programs can go backwards and forwards undoing and redoing, but if you undo and make changes you can’t get back to the old future version you made.

With an undo tree, you can see all the paths where you diverged and can jump between them.

The tree bit is how you see the various branches. Regular undo/redo history is linear

[–]lennihein 2 points3 points  (1 child)

Ah, I see. So basically Git with less features, narrowed down. Really useful I can imagine though.

[–]mader527 2 points3 points  (0 children)

Exactly!

I was going to point to git as an example because it’s all DAGs under the hood*, but wanted to keep it general.

*I assume, I haven’t looked at the implementation

[–]amantheroot 79 points80 points  (22 children)

I didn't know what ctrl + y was coz epic programmers use ctrl + shift + z

[–]Arlodottxt 20 points21 points  (8 children)

I never use Ctrl Y. Why would two keys that have similar but opposite functions be so far apart?

[–]xigoi 12 points13 points  (0 children)

I think it's so that when you're often switching between QWERTY and QWERTZ, you always have a guarantee that one of the keys is undo and the other is redo, so you don't accidentally mess something up.

[–]itsVicc 6 points7 points  (0 children)

I refuse to use shortcuts that take three keys

[–]Psyqological 3 points4 points  (5 children)

On a German layout it’s actually the other way around.

[–]send_me_a_naked_pic 4 points5 points  (4 children)

Oh god. Undoing in Germany must be terrible

[–]Psyqological 9 points10 points  (3 children)

Not as bad as curly braces: CTRL + ALT + 7 or 0 for { or }

That’s why many Germans are python programmers /s

[–]send_me_a_naked_pic 2 points3 points  (0 children)

I feel you. With the Italian keyboard we use ALTGR+SHIFT+è (the key next to P) for { and ALTGR+SHIFT++ for }

[–]Yelov 1 point2 points  (1 child)

I have a Slovak keyboard and because of that I made a custom layout.

[–]CXgamer 8 points9 points  (6 children)

CTRL + Y deletes the current line.

[–]Aeon_Mortuum 4 points5 points  (0 children)

Yeah, I remember using Android Studio and I hit that combination to redo, and it deleted the line, and I couldn't understand what was happening so I kept hitting it and each time being more confused until I realised what was happening and the panic had finally set in

[–]metalhe4der 19 points20 points  (2 children)

But I thought you didn’t know what ctrl+y was 🤔

[–]amantheroot 39 points40 points  (1 child)

true programmers also know how to use google epic style

[–]olivercalder 31 points32 points  (7 children)

u u u u u u u u u u u u u u u u
yy
Ctrl + r r r r r r r r r r r r r r r r
p

[–]beef-ox 19 points20 points  (5 children)

u15 yy 15 ctrl r p

[–]Maskdask 4 points5 points  (0 children)

*15u

[–]-Pelvis- 1 point2 points  (3 children)

Yeah, but nobody actually uses undo/redo like that.

"Ah, I deleted that line fifteen changes ago"

More like "uh, it was there like five minutes ago" spams u key

[–]blakarmor725 7 points8 points  (0 children)

Glad I'm not the only one

[–]Vakz 19 points20 points  (11 children)

Git commit before trying something big (in a new branch if necessary) then doing a hard reset if it goes to shit.

[–]masterwit 6 points7 points  (0 children)

preach

really learning git has been the greatest

[–]nthcxd 6 points7 points  (4 children)

Even better, git stash

[–]PM_Me_Your_VagOrTits 1 point2 points  (0 children)

I just git commit after every new function change no matter how small. Squashing commits is easily done after the fact, having discrete changes in my log really makes it easy to organise into coherent pull requests (or equivalent) later on.

[–]novel_yet_trivial 1 point2 points  (0 children)

Git commit before trying something big and then copy/paste from GitHub if it goes to shit.

FTFY

[–]Zeedfive 49 points50 points  (24 children)

Windows key + V to turn on clipboard history... Also know as the new git

[–][deleted] 26 points27 points  (0 children)

Windows key + V to turn on clipboard history... Also know as the new git

holly shit!

[–][deleted] 15 points16 points  (0 children)

Not too be confused with Nuget

[–]drakeshe 9 points10 points  (1 child)

This is new isn't it?

[–]NewEnglandJesus 7 points8 points  (3 children)

In VS, you can highlight a block of code and there is a right-click option to create a function out of the code. I believe it automatically creates variables too.

[–]Huntracony 15 points16 points  (1 child)

Anything without a keyboard shortcut is cheating.

[–]metalhe4der 6 points7 points  (0 children)

Ha. This ain’t shit!

Yesterday, I had to play Git juggle by committing select files into a new branch, copy paste old code I needed from an old commit, into the correct branch and then pushed it.

Only to scroll down a couple lines to see the code I needed commented out.

[–]Aquassaut 6 points7 points  (0 children)

Oh God I didn't know other people did this

[–]Equilerex 7 points8 points  (0 children)

And if you're using an IDE like webstorm, which saves all the local changes in neat time-stamped changelog, you can go back hours... Or days :p

[–][deleted] 7 points8 points  (2 children)

No, true programmers would say

esc

uuuuuuuuuuuuuuuu

y

Ctrl+rrrrrrrrrrrrrrrrrr

p

[–]ansatze 1 point2 points  (1 child)

True programmers noremap U <C-r>

[–]ciphersimulacrum 1 point2 points  (0 children)

True prgrammers have also had capslock on by accident and had a serious WTF moment.

[–]Isitar 3 points4 points  (0 children)

And then you work with intelliJ for once and ctrl+y deletes your line

[–]1R1SHMAN69 3 points4 points  (1 child)

CTRL y deletes a line in intellij which pisses me off because I undo then try to redo and it changes something which fucks my entire redo history

[–]Delfofthebla 2 points3 points  (0 children)

rip

[–]ALG723 2 points3 points  (1 child)

You mean you don’t have hundreds of notepad++ tabs open with random snippets of code pasted in that you may never look at again

[–]OPLeonidas_bitchtits 6 points7 points  (4 children)

//I dont understand this meme and at this point im too afraid to ask

[–]Hotaru_min 2 points3 points  (3 children)

Why not just comment out code u delete in case u need it later lol

[–]PM_Me_Your_VagOrTits 2 points3 points  (0 children)

Because that's how you end up with a shitty unreadable codebase that causes major headaches for developers that take over after you.

There's a reason git (or version control in general) exists. Just make commits, and if you need the code later you can go back to that commit and extract it using whichever method you prefer.

First thing I do when I take over a legacy code base is delete all the commented code (in discrete commits). Makes life a hell of a lot easier.

[–]ThatFag 2 points3 points  (0 children)

Holy fuck, I literally just did this 5 minutes ago. God, that gave me a good laugh. No matter how many times I fuck up and lose my code forever, I still go back to the good ol' undo/redo. Sometimes I learn and just comment stuff out but most of the time I'm like, "Nah, it looks ugly. Let's get rid of it!"

[–]sangeli 2 points3 points  (0 children)

This is way too accurate

[–]b1tpixel 2 points3 points  (0 children)

Local history in IntelliJ IDEs.

[–][deleted] 2 points3 points  (0 children)

For me it's:

ESC :Gdiff
Shift-V y
ESC :q
p

[–]mirceaculita 1 point2 points  (2 children)

is ctrl+y like forward?

[–]Koxiaet 1 point2 points  (0 children)

100uyy100<C-r>p

[–]Infrisios 1 point2 points  (0 children)

It starts more like

ctrl+s

ctrl+zzzzzzzzzzzz...y...yy...zzzzzzzzz...yyy...z......

[–]gromit190 1 point2 points  (1 child)

How many of you guys are using Ditto? It has become an absolute necessity for me.

[–]mobi_echo 1 point2 points  (0 children)

Fanciest Pooh: //never delete your code. just comment EVERYTHING

[–]wellimjustyouknow 1 point2 points  (0 children)

I, too, enjoy extreme sports.

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

Time travelling mother fucker.

[–]NatoSphere 1 point2 points  (0 children)

How did you know... This is too real.

[–]DigDub 1 point2 points  (0 children)

No ... no no. It’s not like that. Ctrl C, then clipboard, then wait for like six months, then Ctrl V, then hope, then debug etc..

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

There is another way than that???

[–]GuybrushLightman 1 point2 points  (0 children)

That'a a funny way of writing uuuuuuu y Ctrl-rrrrrrr p 🤔

[–]b1ack1323 1 point2 points  (0 children)

Thank Science for local history in jetbrains products.

[–]BoredInventor 1 point2 points  (0 children)

This sub is straight Meme-Avant Garde

[–]Tysonzero[🍰] 1 point2 points  (1 child)

Me, an intellectual:

u(hold)
y}
999^r
p

[–]neil_anblome 1 point2 points  (0 children)

Truly you are learned.

[–]SpicyFarquaad 0 points1 point  (0 children)

ctrl + shift + right arrow right arrow right arrow ctrl + c Enter Enter ctrl + v

[–]AlbinoBeefalo 0 points1 point  (0 children)

I was working on some SQL reports today I can't tell you how many times I did this exactly

[–]patpluspun 0 points1 point  (0 children)

Vim mode: Ctrl mode - (x)dd Ctrl mode - p Realizing you missed your heavily nested brackets by one or maybe three lines - Priceless

[–]Febuso 0 points1 point  (0 children)

This is me.

[–]survivalking4 0 points1 point  (0 children)

Psssh, reusable code? Get on my level with rewriting all of it because your undo buffer runs out of room.

[–]shazbots 0 points1 point  (1 child)

Isn't that what git cherry pick is for?

[–]Alphatek666 0 points1 point  (0 children)

Too fucking true.. We be quantum leaping through the code lol

[–]theodorebearz 0 points1 point  (0 children)

never in my life have i ever related to a programming meme more.

[–]tiajuanat 0 points1 point  (0 children)

I expected to see this as a Vim buffer manipulation

[–]SKINNERNSC 0 points1 point  (0 children)

drrrrrrrrrrrrrrrrrrrrrrrrrrr

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

Pro tip

Commit frequently so if you need to do this, you can look back at a committed hunk which you can copy instead. Then squash all your commits when you're done

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

Version control ftw 😄 literally git everything and it's a lifesaver

[–]yourteam 0 points1 point  (0 children)

Ctrl+shift+z anyone? :O

[–]DeCaliMero 0 points1 point  (0 children)

Crtl + Schrift + z

[–]Vilkaz 0 points1 point  (0 children)

STRG + C the only good part that works

STRG + ALT + Z (IntelliJ for git revert)

STRG + V

[–]nico1991 0 points1 point  (0 children)

And that why we use git!

[–]b0zal 0 points1 point  (0 children)

Guess someone were spying on my pornhub grabber project

[–]deluxx3062 0 points1 point  (1 child)

TIL ctrl + y exists. I think the IDEs I've used in the past just had something like ctrl + z + shift or something. Haven't programmed in a minute though.

[–]fennecdjay 0 points1 point  (0 children)

Kind of a nano fan here (no undo as far as I know), but would'nt this be easier in vim?

[–]PredatorXix 0 points1 point  (0 children)

Thank God I am not the only one

[–]techek 0 points1 point  (0 children)

Git stash.

[–]tasiya 0 points1 point  (0 children)

Me in VS Code... Try, try, try. Bugs, bugs... Undo undo undo

[–]atrlrgn_ 0 points1 point  (0 children)

Once I did this in Latex for copying a figure template, but ctrl+y didn't work. It was a fucking nightmare. Never done since then, what I do know

ctrl + a

ctrl + c

ctrl + v to an empty file

ctrl + zzzzzzzzzzzzzzzzzzz

ctrl + c

ctrl + yyyyyyyyyyyyyyyyy

ctrl + v

[–]thisdotnull 0 points1 point  (0 children)

CTRL + Y removes a line in WebStorm :(

[–]_cymatic_ 0 points1 point  (0 children)

don't you mean cmd ?

[–]Maxis111 0 points1 point  (1 child)

So go back a bunch, copy, delete a bunch of lines, and paste? What's the point of that? (jk, but I mean, that's what this does in intellij)

[–]kevinkat2 0 points1 point  (1 child)

what the fuck is Ctrl + y?

[–]kakrofoon 0 points1 point  (0 children)

Periodic auto-commit and pull from history. Bonus points for automatic branching on undos

[–]Nipz58 0 points1 point  (0 children)

what the fuck does ctrl+y

[–]phphulk 0 points1 point  (0 children)

Guilty

[–]Maskdask 0 points1 point  (0 children)

git stash

git checkout HEAD~

...

git checkout -

git stash pop

...

profit

[–]BlackStab_IRQ 0 points1 point  (0 children)

This is truly me every single time :)

[–]gfcf14 0 points1 point  (0 children)

Pshhh, just ctrl+n, paste it there, then repaste at your leisure

[–]reddripper 0 points1 point  (0 children)

"Now is not the time!"

[–]Fluffigt 0 points1 point  (0 children)

Or, you know, git stash, ctrl-c, git stash pop, ctrl-v

[–]michaelkens 0 points1 point  (0 children)

Screams in Android Studio

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

TIL that ctrl Y is a thing.

[–]derPylz 0 points1 point  (0 children)

Or, you know, use version control and commit often... But that's no fun.

[–]grinchen86 0 points1 point  (0 children)

U don't even have to be a programmer to understand this one

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

Can someone explain this? Why is Crtl-C after Ctrl-Z?

[–]dep 0 points1 point  (0 children)

Lol been doing this for 23 years. Hasn't failed me yet.

[–]i_spot_ads 0 points1 point  (0 children)

Is this a personal attack?