 Good news everyone tonight. We are finally going to complete the system of German idealism because over the years I have done many videos on command-line programs to get things done efficiently neomut for mail news boat for RSS. I don't know like NCMPCPP for music. I don't know why they named it that SXIV for images, right? That's not even command-line thing, but it's it's minimal But there's one program that I've been using for years and I've never done a video on and that's for good reason It was kind of a work in progress. I mean everything's still a work in progress, but It is this program here. It is LF. I'm glad I've Procrastinated not procrastinated. I've waited for when it's I don't know worth doing a video on LF started out. I've been using it since it started out a couple years ago, and it was kind of I don't know It was not very commonly used. I think it's a lot more common now This is what it is. So it's a command-line file browser. In fact, I use it way more than probably any other Terminal program, you know a kind of pseudo graphical terminal program. I don't know exactly what you would call that but Tuy terminal user interface, whatever So LF is actually very very nice You can see that actually I'll go ahead and say because some people are already thinking it. Hey Luke LF Looks exactly like that program Ranger and that's right. There is another Program called Ranger that does all this kind of stuff and it's existed for much longer and people probably more familiar with it But the thing with Ranger that always kind of annoyed me is that it was very sluggish. It was very slow It was written of course in Python, which theoretically their Advantage is the writing things in Python But if you are doing things very fast and that are intensive and you have multiple things running Python is not what you don't want to have a file browser in this LF is a rewrite. I mean not exactly a rewrite but kind of a clone of a Python written in go that now I think is is coming. It's coming to have its own I think it's I haven't used Python or Python Ranger I haven't used Ranger in a while and I don't plan on ever using it again In fact even nowadays you you have image previews in LF These actually aren't by default, but you can easily add them in I'll show you how to add them in at the end of the video. In fact, you can even have previews for image previews for PDFs I have an example movie here So all kinds of files you can get either text or You know video or image previews. So the basics of Basics of LF obviously like any sensible program it has been binding So J and K to go up and down H to go, you know upwards or left words in the directory structure And then L goes right words in the directory structure and it also opens files So we can open this file with L and it will pop up in whatever program We tell LF to use by default to open stuff up with So I'll go ahead and say and of course you have other things like I think G to go to the top That might not be default. It might be GG by By default I'm not quite sure Capital G to go to the bottom Typical VIM bindings and of course for anything you could go ahead and check the man just type in man LF and Check it out there. They're actually used to not even be a man. So I'm glad that there is one now Either way, I will go ahead and give this caveat You can check the manual if you want to know all the defaults and all the the basic stuff But I've been using LF for a couple years and I have my own setup And I'm not actually sure what's default nowadays because it used to be they had there were a bunch of things that they didn't even have By default you had to write in yourself But you know and oh and I should say other basic bindings is Spacebar selects things. So I'm selecting things with the spacebar, right and deselect them with space as well But let's say I want to move this file Let's say I select this file and that file and I want to move them I can press D to I mean, it's kind of like DD and VIM right delete or not delete but like cut And then you can move over here and paste them in. Okay, so we pasted those in and you will now see where is it? So here's the Voynich manuscript and here's the Markdown file that we have here. So I will actually take those back actually we can yank them with Y and Copy although I only yanked one of them because I changed command So we'll yank actually we'll just delete that or D to move Okay, so either way D is cut Y is yank P is paste That's that's all you need to know and select things with space. All right That's all the basic bindings everything else you add in yourself. Okay, or at least that's how I back in my day That's how we did it. Okay, so LF's configuration file like any sensible program is in dot com fig if your program is not done If your program does not have its configuration files in dot com fig you are making the world the worst place I just want to tell you that there are only a couple people who still do that But either way dot com fig slash LF the main file is the LF RC I'll talk about scope in a second that has to do with previewing files and cleaner This has to do with Generating image previews are actually ungenerating them either way, let's open up LF RC And I should say that all of the configuration files that I use are on my github on On the void rice repository, which I'm sure I'll link below or if I forget it's on my github I think that's linked in the video description anyway So you can check the manual for all the different variables, but LF. I'll go ahead and say by default Here's what I remember when I first installed it They didn't even have a command to delete files So you had to add a command like that or other commands yourself So for example here, here's how you create a command you just say cmd name it I named this delete and then within these brackets you basically give shell syntax for a user interface So all this is is you know if I go to something and I press D. This is the interface you're getting it's actually let's let's make this Sorry my background is a little I don't know interfering with things so What this thing here it prints out the image name and asks if you want to delete it and you could say yes or no This see put thing is just to get it kind of in the middle of the screen I don't like it when it's at the very top of the screen with a prompt I don't know why that's just how I am And if you say yes, it'll delete it right so the idea behind this is how I do it You can do it differently, but this is in general how you can create commands notice I have one for deletion. I have one for extraction I have one for moving files to other directories and this actually uses a file in in my You know, I kind of I kind of have like a bookmarked bookmark directories file So if I go to let's say Voyage manuscript here by the way ever read the Voyage manuscript It's quite a fetching read, but let's say I want to move this somewhere else I can just type in capital O or yeah capital M and We'll say, I don't know just Docs, right? We'll move it there. Okay So that that's what my thing here This move to command and all of these commands are bound after you define them You can bound bind them to whatever you want. So again, I have moved to bound to capital M delete Notice also. I have some renaming commands see to rename a file Capital A or capital I To rename it at the very beginning like capital I and Vim when you edit from the beginning or you know Capital A to rename it at the end, right? Vim like stuff either way So all that kind of stuff is pretty pretty straightforward. You can check out my configuration files You know, if you want to see more of this. So the other thing That's worthwhile noting Okay, so we have the cleaner script. I'll talk about that in a second. That has to do with the image previews In order whenever you go over files And you want a preview of them in order to set what script you use as a preview word You set it with the set preview or command, right? So I set this script right here that we just saw a second ago scope This is my preview command. Okay, so what I do here is really just it Depending on what the file is, you know, I've written this so that it looks at the file mine type And depending on what kind of file type it is it generates a preview or does something else, right? So in the case of let's say text Like just generic text like this like the markdown file here You see the preview. Oh, look at this It has a file name and the size and all the stuff and it gives syntax highlighting. That's very nice How does LF do that? Well, the question is or the answer is it doesn't do that It calls the external program bat, which is a nice little program You can use if you really want where if you just run it on a file You can generate it generates all this stuff that LF was displaying So what LF is can do is that it can run any other program You want when you go over a file if you want some kind of preview with it So, you know, I use links which is a terminal browser to look at HTML files or you know generate previews for that them Notice also the width things is just so they don't they wrap properly that actually makes it look a little nicer That's what that's for another stuff as well So either way you're at your discretion, you know to add whatever whatever Tools you want to get it info. So audio files. It'll run media info on and things like that. So let's say we go to Just as an example just to show you what that looks like, right? So this is the preview that it gets over here where it just gives information about the file stuff like that Anyway, so you you define how everything works, right now the complicated stuff Looking the complicated looking stuff is all this right. So what is all this this all has to do with image previews Which I think as I've mentioned before Image previews are not default in LF and in order to have image previews, you got to do four things What four things do you have to do Luke? I'm intrigued. Wow. This is like a youtube top four things video, isn't it? Well, I've actually listed out the four things you need in my LF RC, which again, you can find on my github But here's what they are firstly the program that generates the image previews is ubersug Which in America we pronounce ubersug and if you say anything else other than ubersug I'm just gonna bully you because that's cringe. Welcome to America. We're all in America if you're watching this video So number one you have to install ubersug and it is just a python library thing for generating image previews Um, we're back to using python, but it's just for image previews. Whatever it it works It works and it's way I will say ubersug is way better than it's light years ahead of the crap that people used to use like w3m image or whatever That was like back when you used to use that in ranger You would like go over an image and then you would move your mouse off of the terminal and the image would disappear Or if you'd like scroll up and down there'd be like lines through it. It's just so it was so stupid Ubersug is great. Either way, that's the thing you need. So just install that Uh, next we need a scope file that does all the fancy stuff that I'm not gonna talk about but uh, you I guess you saw You'll basically have to copy this image command Which tells ubersug to to create an image uh, uh preview and what you do here is you you Run the image command with the file and all of these like different, um, uh, Arguments that are basically the width and the location of it in the terminal. That's basically what that is It's not super important for you to know because I've already set this up. You can just copy and paste mine, right? Um, so either way you need to have the scope file Um, and then you also need the cleaner file, which I think you may have seen out here So there's a little file called cleaner and this is just when you move away from an image Lf has to clean that crap up since you don't want that image preview anymore and you want the next thing, right? So that's what that does and then the last thing you want to do is whenever you run lf Um, now all of this is set up. The only thing you need is when you run lf You want to run it actually? Let me just open lf u b Okay, so I have this wrapper script called lf u b and when I run lf on my computer I'm actually not running lf itself. I'm running this script Which just prepares the ubersug environment and then runs lf so that it can use it and that's all it does So when I type in so if you look at my aliases in my Zshrc My alias for lf is actually lf u b. I'm actually running that command And on my desktop environment when I press super r, which is my binding to bring up my file manager It brings up lf u b, right? And so I can automatically get these Image previews, okay, so you just do those four things and you'll be good, right? That's all you need to have image previews. Okay, so that that's the interesting thing The only other thing is to note and this is just for academic interest Images themselves you just create images themselves. You just create the image You know some function. I named it image. You can name it whatever and then it'll generate that If you want to have previews of like thumbnails of videos or stuff You have to do this extra thing where you use like a ffmpeg thumb nailer for a video or pdf to ppm for a pdf to generate like to get an image of that And then cash it and then in either way you can just look at my dot files I don't want to drone on about this so A couple other things a couple other little optimizations actually one pretty thing you may have noticed Is that I have icons for everything nice colored emoji icons That I think is also not default Let's let's jump back to home And what I do for that how you get that is lf will automatically read a An environmental variable which theoretically you can set in your zsh or z profile or bash profile or just profile and If you have a variable lf icons That will supply lf with all the icons that it uses for different kind of file types Okay, so you we can actually look at this. So firstly, you know, if you have a png It's going to use this little painting or if you have uh ex means executable You don't have to have extensions. You can have file types Um, so and I don't know why I chose a target for executable files But I feel like it makes sense CSS is a little palette. Wow. I was so cute when I I thought all these up But either way you just put a bit a giant little block like this, which I mean it's not it's big But it runs instantly right put it in your profile file or I guess you could put it in a bash rc or zsh rc Uh, it probably wouldn't be a big deal if you had it running every time you open the Bash or whatever that this probably not a big deal, but um um So that just just lf automatically reads lf underscore icons variable and it will you know create Yeah, it does it does the new it does the needful as they say in india, right? um last thing Last little optimization I have is actually actually it's my zsh rc. I have um Yeah, you probably saw me doing this because I probably didn't even think about it Obviously, I have it bound to super r on my um window manager But a lot of the times I want to be able to just jump into it like without typing And I can just type in on my machine. I just have control o And that will automatically open lf. So what that does in zsh You know really what's happening is I have let's give it a I don't know why I turned that on for like one command um What you have here what that when I whenever I type on or What's the word I'm looking at control o sorry guys this video's gone on too long I'm gonna I'm I can't think anymore whenever I press control o it runs this sequence of characters Which is you know control you to blank the line and then it types in lf cd and runs that now lf cd This is actually the nice nice little perk here a lot of times You want to use lf partially to change directories now it doesn't do that by default But this little lf cd thing what it does is it creates an instance of lf and you can you can use that if you want But it has this extra little perk where if you move to another directory if you want to do work there and you quit Out of lf with q it will automatically stay in that directory you move to so just to be clear I can run that so again control o to get into this thing and let's say go into the videos Uh directory i'm going in here and now i'm going to press q actually we'll go in here To this bids background directory now if I press q i'm actually now in that directory right So you can use lf also to quickly move through uh folders and things like that and um So yeah, I mean that's about it lf is a great program Uh it's still uh they're they're still uh adding things fixing bugs doing doing the needful Um, uh you can check out the github. I notionally linked it in this file here. It's right There There's the link I might remember to put that in the video description But that that's it. That's lf That's the last terminal user interface program that I have not done a video on that I use And I highly recommend it and again if you don't want to figure out setting setting everything up Just go to my github go to my dot files Get the image thing get everything else it all comes by default, you know Install larbs go to larbs.xyz That'll take care of everything for you as long as you can install artx or arch or something like that Everything else is taking care of for you. Anyway, so that's it. See you guys next time