Transcript from the "Marks" Lesson
>> So anyway, so let's talk about fuzzy finding, so for a moment, I am gonna take a quick break from what we're doing and kind of break, just being in completely unused Finland. And what I'm gonna do instead is I'm I want to go seated to my tools, and I'm gonna to execute ready and so, now this is rewriting my end, what it didn't do is install my plugins.
[00:00:20] So I'm gonna to open up vim, and I'm gonna to go a plug install, which I believe everything should already be installed, there we go. Now, when I use Ctrl + P notice I get a nice open up window really quickly, I can also do that, right, it goes right to it also this .c, there we go.
[00:00:34] Look at this, it's even giving me this sweet LSP era, use of undeclared identifier, fantastic, right, there's a lot in my personal experience that's much better. Also notice that the coloring, much better, but the big thing I wanted to show you is that I do have a fuzzy friend or not only do I have a fuzzy finder.
[00:00:51] It also allows for using the highlighting of my current highlight scheme to actually show it in a preview. Which means that I can actually reduce down the view and do some pretty cool things, I can do some really cool things with it, such as take this, send it to a special list.
[00:01:07] And then I can walk through that list really, really quickly and it's super neat but we're gonna save that for later anyways. So I just wanted to show you that I wanted you to all see that that there is a much better experience, we're just not there yet, right?
[00:01:19] We're still just using them or just using some of the basics that plug-in was called telescope, it's beautiful, all right, so let's move on, let's look at another form of navigation called marks. All right, so marks pretty much are what they sound like, you can bookmark a file.
[00:01:36] So the first thing I need to do is I'm gonna come in here and I'm gonna go ready-no-env. I'm gonna go back to my number one stage actually harmed before I do that, go ready and then I'm gonna go ready, no and I believe stage two. I think that's where we're at, let me just make sure there we go, good, okay, so we were just where we are at, awesome, so we're gonna use marks.
[00:01:58] So let's reopen up our vim net, you know our vim now playground, vim dot, let's navigate the way you want either using E and typing it into twitch dot c. Or just navigating to source navigating to twitch dot c and pressing enter, pick a place randomly in the file, and then press M, now, notice down low, like right there, you'll see an M.
[00:02:20] That means I'm in the middle of some sort of command right now, and then pick your favorite capital letter you'd like to use to come back to this point. I'm gonna use capital A, so now i have a mark named capital A, at this position, so let's go to a different file.
[00:02:36] If you're in the same file as me, you should be able to do a space PV if you've done that and see some other files, let's go to this one. I'm gonna use that really sweet shortcut I told you Ctrl WO to close everything else down, I'm going to go down to the for loop, and I'm going to do another M.
[00:02:51] Once again, you can saw, you can see it and you're gonna pick another capital letter, don't pick A if you've already used A because then, you're gonna blow it away, right? I'm gonna use Shift + B, there we go, so I have A and B, now, when I press just a single quotes and a capital A, it will take me back to my first mark.
[00:03:11] Now, the reason why we chose capital letters is that there's two types of marks, there are global marks, there are file level marks, let's I'll show you what I mean by that. So I'm gonna go down here and I'm gonna do an M, and I'm going to do lowercase C, you can see right there, look at that MC and now when I press tick, lowercase C, I'll jump to that.
[00:03:33] Now, let's do or not tick, sorry, single quote, capital B, I'll jump to the other file, now, notice when I do single quote lowercase C. It goes hey, marks not set that does not exist within this buffer, so you can do both buffer level marks and you can do global marks which will work across a project.
[00:03:55] And so, that kind of lends itself to a nice feel, personally though, I'm not a huge fan of marks. They feel like they have a lot of overhead and you have to remember things and I've tried different methods for using marks. I know some people love them marks, I just haven't got there, maybe I'm just not good enough at vim yet to be able to really achieve such a level.
[00:04:14] So instead, I actually wrote my own file navigation plugin, which I'll hopefully have the time to show you later, which I think is the most ideal way to navigate. But in the end marks are a great way for you to be able to have a file one strategy I did hear that I thought was pretty interesting was that, you would set a mark for the main function of your program.
[00:04:33] And you do it for every single project with the same key, that way if you ever wanted to go to Maine, you do like single quote m capital M, right? And so, for every project it had the same meaning and this is much more pneumonic, it's much easier to kind of like keep in your head.
[00:04:49] And so, to me, using marks like that could actually be pretty beneficial, I just haven't quite got there yet, I haven't found my way of using them. If anyone has any great ideas or anything, please message me, tell me how you do it, I'd love to try a new strategy.