 Several days ago, I released the Vim Diesel's official VimTutor Let's Play. It was over an hour long, but in the course I talked about VimTutor and I talked about a lot of tips added on a bunch of stuff that was not in VimTutor. Now one of the big ones that made a big fuss was the fact that you can literally time travel in Vim. So I'm going to talk about that in this video, but in order to do it, I mean here's the annoyance. I actually have to do stuff in Vim before I time travel over the changes. So let's talk about some other Vim tips while we're at it. Okay, so here's a little file here. I'm just going to edit it a little bit because I need, again, I need to edit it to be able to time travel over it. So let's say I do something like this. I want to replace or substitute every single sequence. Really what I want is I want to get spaces between these little entries in here. I don't like the way they look right now. So I'm going to say, okay, substitute whenever you see a sequence of a beginning of the line and a closing of a curly bracket right here. Replace that with a curly bracket and a new line. And so once I run that, you'll see that now there are little spaces between everything. If we want to redo and undo and redo it, we can see the difference. So now we got some stuff there. So some of the stuff we talked in the little tutorial about is commands that you can run multiple times, stuff like that. I think everyone sort of knows you can edit something. Let's say we throw something at the end of this line. You can go to another line and just press the dot command and it will rerun whatever you just ran on a different line. Additionally, we talked about this, right? So let's say I highlight this entire paragraph and then I can say this. I can go into the command mode and I can say run the norm command. And what the norm command does is it just reruns, or well it runs a sequence of normal mode buttons, key presses on all of these lines. Let's say for example we want capital I, capital I goes to the beginning of the line and enters insert mode and we'll say this comes to the left and then some hyphens and then blah, blah, blah. You'll see that now this sequence has been added to the beginning of all of these lines. So that in general is another little hint you can do, another little thing you can do. Additionally, some things I did not talk about, these are actually really cool. Global commands. In fact maybe these weren't in the run videos but here's how a global command works, okay? Really tight. That's how we used to say it when I was in fifth grade, tight. So here's how it works. Command mode, you press G, then what you give it is a sequence of a regular expression for something to match. Let's say we want it to match every single line that starts, so at the beginning of the line, with a asterisk at sign. So all of these entries start with one of those lines. Now what the global command lets you do is it lets you run some kind of command on every single one of those lines. One of the most popular things to do is move things around. So let's say we move it and then we can give it a location to move. You could type in 50 for line 50. You could type in dollar sign for the end of the document. So if we run that we see that all of these lines, just to be clear, all of the lines that started with an at sign are now at the end of the document. That's what just happens. So now things are getting a little messy in this file. We might have to time travel in a minute. Okay, let's see what else. What else can we do to this thing? Maybe I should do some macros. We'll save macros for another video. All right, I think we're good enough. Let's do some time traveling. So the time traveling command is earlier. Let's say, oh I messed up this file really bad and I don't want to press U a million times to go back and undo my changes. Here's your time travel command. You can just say earlier and then you give it some kind of the increment of time that you want to go backwards. So let's say I want to go backwards one minute. Now we're back to where we were before. Except for see, oh look this stuff that I had added at the very beginning is still there. So we can actually go back even further. Let's say earlier 10 minutes. That's before this video even started and you'll see that everything's back to normal. Those original spaces we put between these are gone as well. Now let's say you change your mind, oh I actually like the way I ugly'd up this file. You can always say later and then some time interval, maybe 10 minutes and you will see that everything has gone back. All the changes that you had made have returned. So it's a nice little way. Let's actually get back to how things really were a while ago. So that is a nice little way. If you make some cataclysmic change in a file in VIM, you can just be like oh man maybe I made this seven minutes ago. Maybe I made this 30 minutes ago. Maybe I made it an hour ago. It actually can deal with hour long intervals as well. So let's say later one hour or earlier one hour, it still works. It can deal with pretty big time intervals. So if you make some kind of mistake you can easily rewind or fast forward or do anything else. It would be really nice if you just open a filing you need to write and type later five hours and get five hours of work done. Doesn't quite do that. Maybe in the next version of VIM. But that's time traveling in VIM and some other tips. See you guys next time. This has been VIM Diesel.