 How do you set a mark in VIM? But a better question is, what the hell is a mark in VIM? Welcome to day M on this short series called VIM Alphabet, where we every day attack a letter in VIM, A to Z. I'm Chantastic, and I'm gonna be telling you today about M and how to use marks. Now, of all the lessons, this has got to be the most complicated one because marks really are a very advanced feature and the M part of this really doesn't actually do a lot of the work. All the heavy lifting is in other things. We're gonna kind of like touch on all those and I'm not really gonna dive deep into any particular topic, but we're gonna touch the edges of buffers, how to go back to certain marks, how to go to marks in between files, how to delete marks, just so you have a sense of what M does, but it's not gonna be in depth at all. My goal today is really just to show you M and how to set marks. In order for you to know what they are at all, you're gonna have to see some of this other stuff. So let's dive in. We're going to open, it actually doesn't matter. I'm just gonna open up the Lipsom file. So first things first, we want to set a mark and what a mark is, it's just this hidden marker in your file that allows you to go back to that place at any point. And we set those markers with alphabetic characters. So what I'm gonna do is I'm going to jump over into this second word and I'm going to set marker A by typing M, A. So I want to set a marker and I wanna put that in the A position. And I'm using a lower case A and we'll talk about Y in a second. I can make all of my marks visible by typing colon marks. Now you'll see that there are a couple of preset marks for numbers. We're not gonna cover that today, but those you don't have control over. We can see that now we have a mark set for A. It's on line one, column six, and it gives you a summary of where that line is. Now, I can navigate to any other part of this document and if I hit back tick A, it's going to go back to that marker. Now I'm gonna navigate away again and show you the other way that you can get back to markers. If you want to get to the beginning of a line for a marker, not the exact position, but just the line number, you can type single quote A and that will take you to the line for that marker. And again, back tick A will take you to the exact marker itself. Now because you can use all of the alphabetic characters, that means that you can set 26 markers in a single buffer. So this is what we're looking at right now is a single buffer and we can set 26 markers, A through Z. And I won't set all of them, but I'll set another one here, say MB. We'll label that as the B marker. Now I can jump back to A by doing back tick A and back tick B will take me to the B marker. We can do that for A through Z. So we have 26 lowercase markers. Every buffer that we have, we can set 26 markers on. Now we can also set markers across files. So I'm going to use colon E to edit another file. We'll just open up the quick brown. If I can type it quick brown dot. Now if I tried to go to marker B by hitting back tick B in this file, well, there's no mark set in this file. But I want to show you something. I can use an M and a capital A in this file. Now I used lowercase A in the other file, but I can use capital A in this file and I want to show you something. Let's open up again our Lipsum.txt file. And if I do back tick capital A, it will jump me back to the buffer where I have that capital marker. So as long as your buffers persist, now I can jump between files with the capital letters. Again, I can go to marks and I can see that this capital A aligns to this marker on this file. Now you can always set a marker over an existing marker if you want to replace it, but you may want to delete them as well. You can do that with colon delete mark, which you can abbreviate to Dell M for short and give it the name of the marker that you want to or the letter of the marker that you want to delete. Now if I type marks again, it'll give me a list and you can see that there is no capital A marker. Now I can also delete all markers by saying Dell marks with an exclamation point and that will reset all of my markers back to the default ones that VIM sets for me. Now one special marker that I really like are the angle brackets. And if I go here and do M left angle bracket, I'm gonna set that left angle bracket marker. Then I jump later into this line and do M right angle bracket. I've set two invisible markers. Now in our G lesson, I showed you how to reselect a visual selection. Setting these angle bracket markers allows us to control that visual selection. So now if I do GV, it's going to select the area between the two markers that I set. This is really handy if you want to set a marker, like you know that I want to go from here to here. You set those markers, do the visual selection and then delete, change, whatever. It's a really nice way to make those selections, especially if they're large selections that might go through a couple of screens. I know that was a lot of information. M is a pretty crazy letter and really kind of forces you to dive in to some of the other parts of them that don't have a letter associated with them. But just remember M is to set a mark and while there's a whole bunch of other things you can do once you've set them. If you want help, you can do colon HM and that will take you to the documentation for M and it'll just show you a lot of the stuff that we covered already. If you have things that you use M for, I would love for you to share them in the comments, share them with me. I don't use M a lot, but I would love to know how you're using it and how I could use it to improve my workflow as well. Tomorrow we will be covering N, which is a great letter that I use hundreds of times a day at least. So I will see you tomorrow for N.