VIFM in-depth look and customization

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in previous videos I've shown a couple of different terminal file managers so today I want to go over my favorite one and that's vifm I like to use Vim to edit files I use VI mode in the terminal I even use the Vim Vixen extension so I can have them keys and Firefox so it makes sense that I like VIP and like most terminal file managers it uses the hjkl keys to navigate up and down left and right or in and out of directories you use GG to go to the top capital G to go to the bottom but vifm also keeps with them syntax using a slash for searching DD to delete files why why to copy files or directories switching paints with Ctrl W and H and control W and L but switching panes also can be done with the Tab Key but anyway and there are several other things that I'm not thinking about right now and it's the closest thing that I have found to having a complete vimlike experience in a terminal file manager now other file managers like LF nnn and Ranger can be customized to mimic much of this functionality and the closest I've gotten to my vifm experience has been with LF but that configuration is very very very bare out of the box and if you want to put in the work and get LF where you want it to be by all means do so but it's my opinion that vifm is a much better starting point but this video is not about that today I'm going to go over what I do to make vifm look and feel and function the way I want it to me it looks pretty slick it's pretty fast it looks pretty modern if a terminal file manager can be modern but at any rate let's take a look at the default config and I'll show you some of the customizations I make along the way [Music] okay so in our terminal we're going to just type vifm it's going to open up in your home directory if you're in your home directory but we can't see our DOT files the way to see our DOT files we type in za and then we scroll up to dot config we hit L to go in but we can hit H to go out we go to vifm and the vi fmrc and the first thing I set is my VI CMD I like to change that from them to end them because I generally use neovium as compared to them Now set syscalls this actually makes vifm perform operations on its own instead of using standard system utilities like cpmv and REM it's just a little faster now the trash directory you always want to have the trash directory set because if you comment this out or remove this line or what have you it's going to break a lot of the functionality of the ifm because when you DD a file and you know get rid of it it goes to a trash directory by default in the ifm if this is not set it's just gone and you can't paste it back I always have the trash set but I want to go a step farther than just having the trash set I want to have one central location for the trash to go so I'm gonna go to the end of this line and let's do set trash dirt now I have it equal to and this is going to be in double quotes home slash dot local chair the ifm fresh now if we scroll on down we'll say set history at 100. this is just how many directories it's going to keep in its in its history Now set nofollow links If This Were set to follow links it would automatically resolve all the symbolic links when you press l or return now you can have set fast run I do sometimes I guess I mean I can go ahead and set it now but what this what this does it will try to run partially typed commands so let's say you have a command on here where you gotta hit colon and type in terminal to launch the terminal if you just hit colon and type TR and hit enter without hitting tab to complete or anything without having fast run turn on it's gonna it's gonna fault out whereas having fast run said it's going to try to read that and say oh I bet I bet it's terminal and just run the terminal for you Now set sort numbers it's a natural sort version within text and stuff I mean it's like a version thing uh set undo levels at 100 I generally leave this setting alone 100 seems to be just fine for me Now set vimhelp you can have this set to no Vim help but if you set it to novem help all of your help files are going to be just just plain text there's going to be no no highlighting no links no nothing so I generally leave it set to them help Now set no run exec this one if you have set run exec and you hit enter on a file that's executable it's going to run that executable if you have set no run exec it's just going to open that and let you edit it color scheme is default and as you saw earlier when we opened when we launched the ifm that color scheme is not great so we can change that if we want and if you want to get a list of the default color schemes I'm just going to get out real quick if you go back to the root directory and you go to user and then go to share and then go all the way down to the ifm and then go to colors you see you have a few color schemes in here there's astral there's the demilith rights built and Zen burn and honestly none of those look great so what I'm going to do I'm going to show you where to go to get some better color schemes and we need to get back into our config file so let's do comma C and that opens up our config file now if we the set time format that's just like a regular variable if you however you want your time to be displayed right now it's going to show the month the day and then hours and minutes you can have it set year month day you can have it month day year doesn't matter now the wild menu wild menu is pretty cool uh you can have it set to be a pop-up or a bar by this next setting here but the wild menu let's say if we quit out and then we hit colon and then let's say set and then that's the wild menu all this right here and you see it's a pop-up and you can actually go through and I'm just hitting tab to move down the list I just hit escape to get out and I'll hit comma C to get back in foreign suggestions there's normal visual view other pane Keys marks and registers now the suggestions and stuff that's going to be if we quit back out of here and we hit let's say c we're going to get something in this in the other pane you know suggestions for what we can hit next whether it be capital w c g l o p w now this set ignore case and set smart case is wonderful for me especially when I'm going to search for something in vifm because said ignore case just means it's a case insensitive search and then when you set smart case on top of all that it still means that it's a case insensitive search unless there is a capital letter fantastic now we're getting now we're getting to some more meat and potatoes of the settings here the set no HL search or no highlight search it does not highlight all of the matches automatically awesome love that it's that incremental search I like this one even a little bit better than that it will actually search as you type incrementally love it Now set scroll off equals four this if you're going into a directory that's got just a ton of files in it and you're scrolling through there the page is going to start to scroll when the cursor gets four lines from the bottom or four lines from the top I generally want to start scrolling a little before then so I actually change this to eight so now when it's eight lines from the bottom or eight lines from the top it starts the page starts to scroll now the status line I generally left this alone while I was really new to the ifm because I like to have the hints every time you would log in or every time you would launch rather vifm it would give you a hint and give you something cool it can do you know some a command or what have you that it can do and right now what this does is it gives you the word hint displays a a hint or a command or a command that you can run it's going to give you the file attribute it's just going to give you the date that kind of thing now you can customize this to your heart's content you can even add colors and have background colors and foreground colors and all that kind of stuff and it's going to be in the same kind of syntax as your your color schemes in vifm so anything that's in a DOT vifm file that kind of syntax is going to be how you set that here set that in the file and I'll show that here in a little bit when we go to launch into my config now marks bookmarks B Marks quick marks however you want to call them they're all good what I generally do let's say Mark B is going to take you to your home bin directory what I'm going to do I'm going to add dot local slash bin and then Mark H is going to be your home directory now I'm going to add a couple of more just to kind of show some stuff off here I'm going to say Mark D home slash Dot local share LD dot files why I did that I don't know and then Mark let's say p home slash dot local I'm sorry let's just go to the pictures directory and now the next section are the different custom commands that you can set and what this is what this is I imagine it like a template so when you're going through this you see you have a command and an exclamation point the next is what the command is going to be named so it's going to be DF and DF is going to run DF Dash h or sent M and then 2 into decimal so when you hit colon DF it's going to pop up a menu window and it's going to send all the error messages to death note so let's take a look at that real quick if we hit colon WQ to right and quit that and then reload if we run if we hit colon DF and we're instead we're in standard you know normal mode and hit colon DF we get the output of the DF command with all the errors sent to Dev null and it's in a little menu window now to get out of this colon queue and you're back where you were and let's go back to our file comma C all right now the next one is a diff and this has been pretty great I want to change this from from Vim to nvim but let's say I want to run a diff on my vifmrc and my the original the ifmrc just to see every all the changes so let's do you know colon WQ and let's reload the config all right we're going to go into the config file into the ifm we're going to hit Tab and go over and go over here let's hit za go up to config the ifm I'm going to go down to let's say ldvi fmrc just because I named it that because well that's my file we're going to go down here and let's go to original RC now you see they're both highlighted right now so since they're both highlighted or got the star in the inactive window whatever we can hit colon diff and that's going to pull up a diff for everything and you can go through and see what's been changed what's been added all that kind of stuff that's pretty cool of course you're going to do this probably in a half and a half you know monitor width terminal or full monitor width and you're going to be able to do a lot more with it so essentially what this is is two neodym windows in a vertical split and you can kind of go back and forth in between and move stuff around just do what you normally do in any of them but you're doing this in a diff all I'm going to do is I'm just going to hit kill and Q to get out of both and that was the diff so let's hit comma C again and search for command exclamation point so you can do this and you can do the same kind of Syntax for running a zip you can do something for a mate command you can make a directory and CD into that directory all at once now let's make one of our own when I go to the end here and I'm going to say command exclamation point and let's say I want to get a preview window to pop up you know not necessarily in vifm in the opposite pane but let's say I want to I want sxiv launching thumbnail mode when I'm looking at wallpapers or whatever just something to make a command with so what I'm going to do I'm going to say command exclamation point PV right after that we're going to type sxiv Dash TR and what that is is thumbnail and it's recursive so it's going to work on directories not not so much on just files and we're going to say percent D or the directory that it's in that we're in and that's really about it so if we hit colon WQ and then reload and then let's say I want to do and oh I want to use one of my marks so let's do uh single quote d and let's go into local share backgrounds all right so now we've got we got a few directories in here with wallpapers inside them that's where the r is going to come into play but we also have this current wallpaper.png so I'm just going to type in colon PV and you can't see that right now so let me change to the other View and let you see what popped up and you see I have an sxiv window that popped up and I can kind of go through and look at all the wallpapers all right cool so comma C then if we go on down the file you'll see you have a bunch of file openers and you can set these how you want but uh generally what I do all of the image files I'll set the viewer to sxiv I'll set the opener to or I'll set the PDF viewer to Zathura I'll set the MP3 files or wav files or what have you two uh FF play in play or something like that usually in player or I'll have uh all the video type files I'll have that open with uh MPV and what you do for that is you actually go up here to the first one of how it opens you know you use an FF play you can change that command here to let's say MPV so I'm going to change this from FF play to MPV and I'm going to change this to MPV and that's pretty much all you got to do and you can do that for man page openers and viewers you can do it for all kinds of image images anything to do with with gpg you can change anything anything and everything that you can think of you can change it now torrent files let's say anything it's a DOT torrent right now it's looking to it's looking for ktorrent I don't have k-torn installed so let's say I want to change that to transmission gtk then as we come on down there's a ton of these there's a ton of those settings in there so set vifm info is where you actually set stuff that gets saved in between your vifm sessions so right here it says set vifm info there's D history saved or C history State Tui all that kind of good stuff and you see it saves bookmarks so we actually could have set those bookmarks that we typed out you know in the ifm that's where we're using it because it's going to save all that anyway but for me I like to hard code them in because I know for a fact they're going to be persistent and sometimes I'll get to editing something and I'll take this I'll take bookmarks out or be marks out or whatever and all of a sudden it's not persistent anymore so that kind of bit me one time so I started hard coding them most of the time when I open up vifm I usually want it to open in the directory I'm in or in the home directory not necessarily where I left off so I'll take this save durs option and I'll get rid of it you could leave that if you want but for me I like to start in a certain spot and plus I've got shortcuts for everything now your sample mappings let's say you wanted to set up some mappings or what have you I'll show you how to do all that now normal mode remaps or in no remap let's say you're in vifm and you just hit the S key it's going to open up a shell in that current directory so if I hit colon WQ and then just reload we can do let's say s and see we're actually in local share ld.files.localshare backgrounds we can just exit right out of that so if I hit comma C so now we can have a sorting dialog here so if you want to sort your files a certain way so if we get out of this and then reload and then let's say capital s you can actually go through and sort those files by extension by name by type by the Directory Group ID all kind of stuff honestly that's really cool now the Endo remap W will toggle the visibility of your preview window now the preview window a lot of that stuff was actually set up here that I just kind of glossed over now a lot of your text files and stuff like that are going to be no problem to show some of your PDFs may not be quite right you may have to install some a package or two for that like a PDF to text or dot or docx2 text or something like that you know for your Word documents and all that to show up in image previews for that but you have a normal mode remap for w and a visual mode remap to toggle the uh preview window which is going to be in the opposite pane from your active pane here it says open a file and exit in the existing instance of gvm I don't use gvm so honestly I want to use o to open to do that with so I'm just going to change that to NVM and I'm just going to change that to invent so now I can just hit o on a file and it will open it in them but also let's say I want to open something as root I'm going to use do as for this because I've already got it set up and I have do as set up to not take a password from you know if nvim is used I know that's not real secure but I'm the only person that uses this computer and well you know it is what it is so I'm just going to go into visual mode here and we're going to change this we'll see and we're going to do do as in them now if you want to open up files in the background you can do that with GB and it's going to open up with the default with its default opener and like I said a lot of that stuff that I kind of glossed over that's where you get into the weeds and kind of get into the details of what opens what and then if you wanted to interact with your system clipboard if you don't want it to use x-clip you can change that here or if you don't want to use Excel you can change that there and here you can have mappings for faster renaming so let's say CW is just not fast enough for you you can hit capital I and it will automatically have the cursor at the beginning of the line so much like in them or neovim if you're scrolling through a document you know much like we are right now and then let's say we hit capital I that puts it that puts us in insert mode at the beginning of the line and if and much the same if we hit capital A insert mode at the end of the line it does the same exact thing in vifm but if you hit CW in vifm it's going to put you at the end of the line much like capital A would but a lot of the stuff that I'm renaming will have those file extensions that I don't want to change so to get around that you can do c capital W and it will just do the rename without the extension but I never think about that doing C shift W to do that so I'm just going to go ahead and switch those right now so I'm going to do in no remap CW to C Capital doping and I'm going to change C Capital W2 CW now in the remap comma T will open up an X term I don't really use x term that much so I'm going to change that to St you can change it to whatever terminal you want I generally use St so that's what I'm going to use you can change the kitty you can change it to alacrity whatever you want to I just I generally use St so that's what I'm going to use now comma C this is what you've been seeing me actually go in and out of eifm in the config with so comma c will actually run this command colon right and then pipe that through edit my vipm RC and then pipe that through restart and run carriage return you know fairly simple but super duper useful you can toggle your wrap settings with comma W and you can edit your function keys with these right here and we should be getting down toward the end of the file right here now since we've done all this I'm just going to go ahead and show you some of the stuff that I put into mine and stuff that's not that wasn't really mentioned in this uh config so we're going to look at you know setting a couple of more commands we're going to look at setting a few more key bindings we're going to actually set up some tabs let's go back up here to where we were and let's look for mappings I'm just going to go down here to the end where all that was and let's say show my DOT files with the period instead of za so let's do end no remap Dot and then z a and that's all that's all it takes in vifm there is a way to go through and select files t button with the T key I can never remember the T key I always want to hit the space bar you've seen me do it a few times here because spacebar will actually change your pains as well I want the space bar to be my selector so I'm going to hit comma C once more and let's go into mappings again and let's do end no remap space to t and all and what that's going to do we're going to reload that and let's say I want to select that select that select that and you see they have changed colors and they are selected if I want to unselect it I hit the space bar again and I can do a bulk rename or any of that kind of thing now we also have tabs in this file manager as well so I'm going to set a normal mode remap for spawning new tabs getting rid of tabs moving you know moving between tabs that kind of thing so I want to move between tabs with j and k because that's what I'm used to so let's see we're going to spawn a new tab we're going to say end no remap we're going to say space t and we're going to run a command or a vipm command so it's going to have a colon we're going to call that tab new and then run carriage return I've just copied that we're going to change that to J and we're going to change tab new to tab previous now we're going to change this to K and since J was tab previous K is going to be tab next and this one I want to be able to close the tabs and since I have been Specter WM and mod x is what I used to close windows I'm going to close tabs with with X so space X it's going to be tab close now to show that off let's write and quit and then reload and let's go home on both of these all right and you see I am toggling with my with the period key I'm switching back and forth between there so now let's let's create a new tab so let's do space t and you see we have tab one and tab two up here and you see that it actually spawned a tab line up here so if we hit tab to go to the next plane and hit space t see we have three tabs and if I wanted to move between those tabs space j foreign SpaceX that is super useful now another thing that I wanted to do was I wanted to be able to set the wallpaper from it from inside here so I'm going to hit comma C again and then we're going to do another search for mappings and scroll down here to where we were and I want to go in no remap BG and I want it to run a shield command so I'm going to give it the exclamation point we're going to run X wallpaper dash dash Zoom on the current file and then run carries return all right so let's try that out so if we go let's say we go into dot local share background let's go into groovebox and right here let's say we want the rails all right we've got it highlighted let's do BG you know what you didn't see that so I'm going to transition over back to my other page and we're gonna go pick another one so let's say groovebox forest BG come down here the satellite BG come down here to town BG go back up to let's say dev1 PG forestry BG kind of nice right so let me switch back to the other View and let's take a look at the vifm colors because we're going to go to a website real quick and see where to get more of these uh color schemes from all right so in our web browser if we go to vifm.info slash color schemes.shtml this is the vifm website so it's going to have your homes gonna have documentation the manual the cheat sheet downloads color schemes Gallery all kinds of fun stuff but here is where I wanted to show a lot of the color schemes so of course you're going to have your defaults like Anson astral you're going to have desert dark desert Dracula Fargo which looks kind of funky uh G80 which has been a Vim color scheme forever uh you you've got Groove box you've got Iceberg you've got MC like which is gonna be like a midnight Commander type thing and Malachi which has been uh Vim color scheme forever you got a Nord you got a one dark a pale Knight a paper color dark paper color light uh solarized dark Zen burn Snow White there's a ton of them and I've even customized some of these a little bit so what I'm going to do I'm going to change the color scheme in my vifm to match what I've got so if I go back into my vifm and I just type in pillar scheme you see I've got a ton of them here and let's say I wanted to go to groovebox and then I'll go home you can see it's looking a lot better now all right so now we've changed the color scheme and gotten something that we that we like a lot better but we haven't changed any kind of ownership or any kind of attributes of any kind of files so let's do that now so let's go to let's say dot local bin and let's say my bar action.sh let's say I forgot to make it executable so I can do this the bashway which would be colon and then say chmod plus X and you see that it's that it's executable you can do this in several different ways I'm going to show you a few right here so let's say we do colon and then change we can change the name we can change the owner we can change the group or the permissions you can scroll with the arrow keys or the Vim keys or you can let's say just hit n for for name O for owner G for group P for permissions so let's change the permissions of it and let's say I want to get rid of execute and then we'll hit enter and see it's no longer executable but let's say you wanted to change it back I'm going to change it another way now so let's do CP all right and it's back executable so that's three different ways that you can change the permissions or attributes or whatever of a file so if you want to change the owner you can do Co and type just type in the new owner or let's say you want to change the link of something so let's say whatever is a link right here let's say if you did CL you can change the link Target so let's say you had a different build of St or something like that you would that you were wanting to build from scratch or something like that you have you have a link to your your St right there you can actually change what that link points to from here good stuff and another thing that I thought was really cool about this uh vipm setup is the fact that these two panes are treated like a split so when I started moving back and forth between splits I was just using the Tab Key but you could do control W and then h or Ctrl W and L or whatever and then I got to thinking maybe you can actually change the layout now since that essentially is a split so let's do colon split I think that's awesome you can actually change the orientation of that I thought that was really cool so let's do colon v-split and we're back to normal now I'm going to change this out and we're going to go straight back to my vifmrc and I'm going to show you a couple of more things from there that I forgot to include in the other one so if we go back to home and then go back to config and then vifm I'm just going to delete the vifmrc and we're going to hit CW here we're going to rename this vifmrc reload and there we are now this is my VIP MRC you see I I always have a tab line up here because I have that set in the config it didn't really mention it in the default configs I saw that digging through the man page and down here in the status line you see I have the file name I have the owner I have the size and the read write attributes down here and they're all different colors so let's go into this vifmrc and let's look for status line so right here you see highlight user one C term BG equals yellow C term FG equals black so what that is is in the down here in the percent one star section right here you're going to have a yellow background and a black font C term f up in user two you're going to have none and you have a blue font and it's going to be bold and you see how you see how I'm going about this now so percent one star is user one percent two star is user two and then you got percent five star which is user five then percent three star and percent Four Star so all of that is just the different colors in the status line and if it were wider you would actually see a little bit more of it but you know it's kind of cut off right now because I'm I'm recording and you see I have more marks and you know all kind of good stuff so I'm going to write and quit that and you see all that changes with all that and you see I got rid of the file sizes that was over here in the file types and all that and or whatever that was over here because that's all down here now so I'm actually I have the size right here so if you did want to customize some of your colors for vifm let's say you downloaded let's say the dark desert or what have you and you wanted to change the background color of it the way you would go about that is you would make a colors directory and then you would put let's say dark desert.vifm inside that and then let's say you want let's say you opened it up and holy crap what's all this stuff what this is is just attributes for each aspect of this of that window so the window is going to have C term equals nine the font's 220 and the background is 223. the directories are going to be bold the font is going to be 77 and it's going to have a default background and a lot of this stuff is just default and if you're wondering what these numbers mean those are those are assigned to certain colors and if you check the man page you're going to see a long listing of all these color of all these numbers and what colors they actually are but if you don't want to do that I've actually got a file in my vifm config directory that's got a listing of all that too so via vifm color codes this actually has all right so this would be the color code that you would put into the file and this is what the hex value of that color is this took a really really long time to do anything higher than like 255 it starts they start flashing so I only went to 255. so if you'd like to if you'd like to take a look at this I'll it's going to be in my DOT files and honestly those same numbers work in sfm as well so if you're looking at the suckless file manager uh those same kind of colors will work there too so that's about all I've got for today I just wanted to kind of show off my vipm config and kind of explain what some of the stuff meant inside the config that would that might have been confusing to the new people and yeah vifm is a wonderful file manager and it is it's got a ton of features it's well implemented it's quick I don't have much bad to say about it and I highly recommend giving it a try awesome with all that said thank you for watching y'all have a good day then like share and subscribe catch you in the next one [Music] foreign
Info
Channel: linux dabbler
Views: 7,577
Rating: undefined out of 5
Keywords: linux, linux dabbler, vifm, VIFM, vi-file manager, how to customize vifm, customize vifm, set key bindings in vifm, terminal file manager, tui file manager, vifm config
Id: hDZ7JscJ5jM
Channel Id: undefined
Length: 40min 38sec (2438 seconds)
Published: Fri Dec 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.