 So, at the request of some subscribers and I guess in the interest of experimentation I've started to do something that usually my philosophy goes very much against and that is using the mouse. In fact, using the mouse relatively totally differently than you've seen it be used before on most operating systems, but still it feels a little weird to use the mouse again. So let me explain the, you may see the video title description, I've started to do plumbing on Linux which I guess I should explain briefly. Now there is this operating system that looks like this called Plan 9 from user space and this is its text editor slash UI slash, it pretty much does everything. Now I don't know that much about Plan 9 but it's pretty interesting in that the mouse, all three buttons are the mouse, left, middle and right, all have an important function and your development environment, your text editor are sort of have mouse, the mouse used as a core key to open things up, send things to other programs, all this kind of stuff. So for example, if I type, I can just type arbitrary text. So for example, when happens to be a command and if you highlight that and right click it or excuse me, middle click it, it will actually run the command. It's really weird. So you can just write a command and run it with the mouse and you know with the middle key or the right key or the right button I should say is often called the plumber or it's a plum key which can do a whole bunch of things including opening files and just other stuff depending on what you have highlighted. So what I wanted to do, I've gotten a couple emails recently about this. People have been asked, I'm not quite sure why, maybe it's just a coincidence but people have been asking for some kind of plumber or plumber ideas for Linux and some people have even sent me their own examples. So I wrote a little plumbing script to replicate opening files or dealing with text highlighted in Linux. Anyway, we'll just get into it. So I'll go ahead and say it has a pretty cool feature that I'll talk about later but some basic features I want to talk about now. So at a basic level, let's say I have a terminal document open. Now of course this could be in the terminal. This could be something you have highlighted in Firefox. It actually doesn't matter. As long as you have that highlighted, it's going to work the same way but I'm using a terminal here. So let's say I highlight this text. Now I have a script that I am using as a plumber bound to super C right now. And if I run it, what it does is it will give me some options. It'll detect first off, okay, this is what you have highlighted but it'll give me some options for what to do. So this is a URL, so I'll say go to URL. There's something like that, so that'll pop up. My internet's actually slow today but the web address will pop up in a browser. Same thing if I have an email address here. I can say, oh, it gives me the option of looks like email so I can open that up in my email client, send an email to myself or something like that. Additionally, you may have noticed in the options, so for example if I have some kind of location highlighted, it'll give me a maps option and that'll actually open it up in a window of open street maps if you want that. So that'll pop up after a second so you can do it. Of course you can change it to Google Maps if you really want. I'm sure you know I don't use Google for anything besides YouTube but that'll do that. Additionally, you can search eBay for something or anything else. Now that's just opening browser windows. That's relatively basic but there's some other things as well. So for example, here if you have some kind of command, let's say said and this could be, again, I'm in Vim right now but you could be on the command line as well but if you have some kind of command highlighted, it'll actually automatically detect that and it will give you the option of looking at its manual and that'll auto-generate a PDF manual and bring it up for you so you can search through it in a different window, again so you don't have to open up a new window and press man or something like that. Just a nice little thing to have. Now one little note here before I'm going to go into how the script works in just a second but I will say one note about Vim is, well I'm using Neo Vim right now. I think it might only be a Neo Vim problem but for whatever reason you're supposed to be able to highlight stuff with the visual mode using V or whatever and that's supposed to, your primary selection is supposed to be able to read from that if you set a particular option, auto-load, you can look it up, auto-select or something like that but in the current build of Neo Vim it isn't actually working so right now you have to select it with, you basically just have to select it with your mouse or whatever but once that gets fixed you can select it with visual mode in Vim as well so you don't actually have to even use your mouse so that's just a note. Okay so let me talk about how the script works but also it's what I think is its best feature. So I'm gonna open up, here's the script I have, it's pretty short, it's in Bash, I usually write things in POSIX compliant shell but I had to write this in Bash and I'll explain why or I probably don't actually have to, I just don't know how to do this in POSIX shell. So the idea behind it is all of the different options or the things you can do, they're all different functions so web search, Wikipedia, Wiktionary Maps, eBay, all those kind of things are different functions and what you can do is, I don't know if you know this but if you say declare F in Bash that'll give you a list of all the functions you've declared so I can actually take, let's say take the third element of this output and we will put that into D menu and then give it a prompt that says pick a function. So that'll give me a menu of all my functions and that's really what this script does, it defines a bunch of functions with what you can do with output and then it just gives you a list of those so I don't have to redo them every time, change the options every time I add a new function or something. Additionally, so for things like email where you're only gonna be using, I mean I only want the email option if I'm highlighting something that looks like email. Right, so it actually checks firsthand before, it checks to see does that actually look like an email address? Same thing with the URL, does that actually look like a URL and only if it does exist does it coin the function and then the function will appear. Oh, I don't think I mentioned before but you can also use QRN code to encode some stuff so I can say QRN code and this text is now encoded in that QR code but that only happens if you have QRN code installed. Now, what I think is the most useful function which I've saved for halfway through the video which is probably a bad idea but whatever is this thing here and I'll just show you how it works first off. So I can go to my, just open up a terminal prompt, get an LS, here's a list of all my files. Let's say I like this file, boomer big, I wonder what that looks like so I'm gonna press my plum key and you'll see that this file has just opened up. It's just popped up, that's all it's done. So instead of actually having to type in, oh, what is my image viewer, it's SXIV and then tab completing all this, you can just highlight it and run the plum key and it automatically opens. Additionally, well actually I'll go ahead and show you, basically the idea is if the primary selection is detected as a file, just open it in XDG open, use whatever your default viewer is for that and works out perfectly. The problem is of course, if you're in, let's say I'm in my downloads directory, so I'm gonna get rid of this for a second, if I'm in my downloads directory, if I were to just run this code, it wouldn't detect that file because the script is running from the home directory. So these lines here, what they actually do is they take the active window that is this one and tries to detect what directory it's actually in. So this terminal right here is now in the downloads directory. So it tries to detect that and then it changes to that directory, then it attempts to find the file. So if I select a file here, it will open even though I'm not in the home directory. So that's just a little hack to get rid of that. There's probably a more elegant way of doing this, it's just that's how I had it. I have another script doing that as well. I mean you may know that in my bindings, if you press super shift and enter, it'll automatically open a terminal in the same window that you have whatever your active windows open in. So that's pretty nice. And again, you can't, so I mean if I LS home, I'm not gonna be able to open these files. So if I'm from my downloads directory, so if I try to open that, nothing, it's not gonna work. It's gonna give me the menu. But if I CD back to home and then I try it, it'll work fine. Which is usually, there aren't too many times where that's gonna be a problem. But anyway, oh yeah, so I made a said 11Q T-shirt merchandise, which is down below the description, just because if you want a shirt for a YouTube channel, involving a joke that literally five people get on the channel, you can get one now. But anyway, so that's that. And you may notice as well, if it's detected as a file and it's opened, it doesn't actually give you the menu to select what you wanna do with it. It's just inferred that okay, this is a file, they just want it opened. And you don't have to worry about anything else. So don't give me the menu of Wiktionary and Maps and eBay and all that stuff. Obviously, I don't wanna do that. But I'm thinking about, I don't know. I think that's pretty good design, but I'll probably play around with the script a little more. I was actually thinking about if you highlight an email, I might just assume that that email is supposed to be opened in your email, default email application. Maybe I'll just skip the whole option thing in the same way I skipped the options if it looks like a file. But I'm not quite sure about that. But anyway, I'm still sort of playing around with this. I am gonna put it on my GitHub. I'll push it relatively soon. But if you have any suggestions for it, it'll probably be up by the time that you see this video. But if you have any suggestions, feel free to give them to me. And as I said with Vim and NeoVim, a NeoVim at least visual mode is not working for primary selection. I think they just have to fix it. I think it's been broken for a long time. But you should be able to get it working in Vim if you set auto select. But I mean, and I'm just talking about using visual mode so you don't even have to use your mouse. But anyway, so that's it. And it's gonna be default underlarbs at the Super C shortcut. And I will see you guys next time.