Vim Chicago Meetup - FZF and Vim Talk - Dorian Karter

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
here uh so today we're going to talk about FCF + BIM how many people here cared about FCF at all I got one - cool uh so I was gonna make some VM Chicago steel but Jake did that so we were in Chicago here and they Bend is sponsored by hash rocket so that's the pizza and air conditioning and all that stuff let's talk about uh let's get straight in the meat of it so FCF is a basic you know Linux command line utility it's raining go and it's a great project by June Gunn Troy uh there's a guy come Korea who writes amazing BIM stuff like he has a lot of vim plugins he writes a lot of really really cool stuff basically what it does is fuzzy finding on text on lines in text so fuzzy finding what do you mean well if you ever used a you know Google and you mistyped something the algorithm behind that is some sort of fuzzy finding and there's a reason to use a 5 minor the main reason is because it makes you first it makes you look really really fast because you're just like typing a few letters and you get to where you want to get so it gives you kind of like psychic like powers or like a computer psychic like power it helps you save precious time and do more with less typing I also allows you to automate processes which will I'll show you later on how to do some of that I think you can also go down here but it's also it makes you feel warm and fuzzy inside that's another not a good reason and why FCF anybody here uses ctrl P to navigate them okay so ctrl P is another way of like fuzzy finding files but fzf does more to that it's not just for that and it's particularly cool because it's a Linux utility and so you can type anything through it and use FISA fine on that it's extremely customizable because it's written go it can run a synchronously and it'll be really really fast so or according to talk to the author its orders of magnitude magnitude faster and I'm going to show you right now a quick demo of how we build like a quick buzz you find you you all know about a git branch right gives you a list of branches I have a fork locally of rails this is rails 5 so as really like all the versions if I look at git branch - are that shows me all the remote branches so there's quite a few of them let's say I want to change the branch right now so I can do there's I have this utility here FCF if I just run it by itself it will show me a list of files and I can start typing for example blade yamo oops blade yamo and it can even type a BL de you know like miss a few letters that's fine so now if I type step through it for example git branch now I get a list of all the branches and get and I can start typing stuff like master and as you can see the star here comes from just get branch so it keeps the output direct exactly as it is now if I want to switch to for example the 3 Oh stable so I have this command and I'm going to wrap it around with a sub command in bash we'll do git checkout and that should give me the output of the fzf will be what I selected so I'm going to say 3 2 and wait a moment and it's there so now we're on three two so that was pretty easy now that might not be very useful if you only have like three but you can be really useful if you don't remember your branches so it's making it like a one command instead of like multiple commands so what if I want to switch to a remote branch so remote branches I don't necessarily have them on my local machine so if I go this and I just say give me uh let's see lock FFI so lock FFI oh I can't really do it it checks out some weird like well just like that that commits Pacific Command that's not exactly what I want I want to track it so I'm going to add let's do two zero master again and I want to add a - - track to that so now I'm going to select lock FFI and we are we now have a local branch called locking to five so pretty cool stuff I basically did something like this an alias that that I load in the beginning of my zester see and so I have that and I have a GC o RB I also have something like f CD which allows me to jump to a subdirectory any subdirectory so if I wanted to see what action cable looks like f CD action cable and then I'm here so this is all like a lot of bash stuff that's not really directly related to Tim but you can use all those techniques to create your own commands and then use them from BIM so that's what that's what it's from how do you get it you basically do brewing style if you're on a Mac for install FCF that's simple if you want to get it on vim I use a the plug plugin manager which is by the same author and if you're going to get it with like you need to do it like this otherwise you can use any other plugin manager but you need to plugins one is the FCF and one is FC f dot n FC f itself comes from I believe f CF from group so that's how you get it now FC f doesn't make you like build all those things yourself it gives you some stuff built in so I'm going to show you some of those commands so this is directly from the help file from FC FM you get out of the box you get files key files all those are calling commands so if you're just good files you'll see the files command get files which shows you if you're in a good directory it will show you all the get files so if you have a bunch of files that you probably will not access from them I will remove those from the list so your fuzz finding is a lot cleaner G files is just a question mark just gives you all the files that you changed in the current in the latest change set that are available from git status buffers shows you the open buffers so let's uh let's start demoing some of those so I'm going to do files so I can see let's say I want to jump to Glade who I'm here I was def s instead of doing like E and what was that thing well this one was not that hard but let's say I wanted to get to called X dot RB so I would have to do like e active there's so many so many things to start with active in rails it's great active model live yeah so get the point another thing that's really cool is buffers so I have multiple buffers right now I have one that is a rake file and I want to jump directly to that I haven't mapped to control B but you can also just type buffers and now it fuzzy finds that so I can jump to the rig Bop let's see what else we have here callers I have a lot of color schemes actually probably too many this is probably tomorrow night and let's say I want to see all the color schemes there are 256 colors so I'm just going to type 256 and now I can just browse through them and let's say I really actually like desert I actually doubt that one let me not that one 256 jungle that sounds fun cool really really messed up what else so AG is somebody here using AG the plug-in AG yeah so the plug-in the AG plug-in actually gets overwritten when you install f c/f them that can be quite upsetting at first but then when you use this AG you like don't even want to use out or one anymore but there's a way around that as well I'll show you towards the end let's let's do a demonstration of that so we're in rails let me return to my trusty color scheme cool so I'm gonna do AG and the really cool thing that's happening right now it just loaded all the files in a matter of seconds and all the contents for all the files so all the lines from everything is here in a buffer and I can say show me a place where I'm including active record or activism or active support so include active support so these are all the lines and I don't even have to type it this is why I like it more than AG I don't even have to type it fully I don't have to capitalize anything I can just start typing you know brains thought stream directly into here and I get everything so if I click one of them I jump directly to it if you have any questions by the way please stop and ask let's say we want to jump to aligning to file it's also possible so let's jump to let's see what's what's in the bottom of this file something that has private let's find the private right so we're in the top new lines private and I can see private here that so lines actually shows me all everything that's loaded in all my buffers but I can also see do be lines which will show me only stuff relevant to this file so now if I did private I can jump directly to it yeah what else we got tags if using C tags really helpful B tags only in the current buffer same thing marks is really cool if you ever do like I do a lot of mm I very rarely do like am something else but marks and them are pretty useful actually right now I have some stuff I don't know why but them retains all my marks from all the points in time ever but I have a VAR c da bundles mark that I put there at some point windows will let you jump between tabs and windows and pains and everything so windows are actually really cool to the locate pattern if you have a Mac I don't know if it's a Linux is utility but if you have a Mac locate lets you find all the files in your system really really fast cuz it index them so if I just do here locate locate slash I can sew it scanning my whole system right now and it just done like that's that's pretty crazy to me it's scanned over a million files almost two million files in seconds and that's the nature of the parallel fgf sure boom so really really fast history em are you so vim retains an M are you most recently used I think and you can see all the files that I open recently if I want to see the command history all the commands that I executed I really like limelight it's one of my favorite commands also by the same author this guy's is amazing but uh let me show you what it does because this is really cool so I can fuzzy find on the and those activate limelight and now as I move it highlights only the context and I'm on I have a TD so me this is really helpful like I don't have to like read a giant file of stuff I just focus on one part table that snippets if you if you use oldest nips it's really useful because for example if I'm in a ruby file like here and let me just do this snippets and I want to insert a while loop so I type while and it gives me two options because it shows you actually what the snippet would look like so I actually like this one better so I edit it I answered it and I say well true sleep one this is a great line of code actually three lines of code to clue in any production system I'm going to do a pull request to videos later so commits this is really cool actually so I'll show you the whole commit tree for this project and I can jump I can fuzzy find on a specific commit text so let's find something maybe mentioning DHH mmm well that's for fuzzy finding something like DJs maybe not that great yeah yeah the coming history and I can see the whole tree here Redis nothing the match directly otherwise would be at the top so that's why I kind of like expands it about what MVR be yeah it's likely there will be on the top if it finds that first uh let's see how about what bug fix failures I found a lot of things rails is reaching bugs it's actually pretty stable um anyway it lets you like let's say one of adequate yeah did I spell all right yes right I don't know matches those are all matches but because it's fuzzy finding it kind of like we want to get to the top if you are in at the top this is where the most matches would be I say initializer then I start finding like initialize configuration initializers so yeah would be interesting sort of if you actually are searching really yeah something like fuzzy I mean I guess you can type it more as is right I think it actually finds quotes so if I say like quote so you found a quote yeah it takes literally you can also do become it's just for the current buffer so you can see how this file has changed and then search on that if I want to see when somebody did something with the execution wrapper execution wrapper boom and then in fact if I ignore the message I'm not sure what's going on here I think it's like something got messed up with with another plugin but if I click it basically opens it with a fugitive so it requires fugitive for this to work commands is also very useful if you forget what a command is called but you remember a part of it like I don't have something with like removing white space but I'm not or what it is let's do that white space so I have a strip white space that's the one I was looking for so let's execute it and that removes all the trailing white spaces getting close to the end maps lets you find all the normal mode maps so if you here do maps and I want to find something related to let's see something maybe about get so get got our next hunk is a closed bracket see normal mode just you know if you forget what is the mapping that you set up it's really useful what else help tags so that's also very helpful if I want to find some help for FCF let's do help tags fzf and then I can jump right into it or I can say fzf commands CMD to get the commands and file types if you want to change the current file type to something else again it's just file types and change it to like Ruby if you want so that covers like the built-in stuff but all those commands there are commands that the author is using on his VMRC and he decided to kind of like open them to the public it's not to say that you have to use those you can build your own and you can make them better I personally use a the get files a lot and get files is not enough on its own because it's not excluding the ignored files but it's taking options that's what you see here so I customize it to my liking let me show you oh wow so I've got get files we are ah it's missing some of my customization so basically I add some stuff at the end I do like - exclude standard which will ignore all the get ignore files and a lot of other files that shouldn't be there I also do - OH - show me the files that are on tract because without that that command is useless almost this is actually translates to - - other and I have one last thing that I add here I'll post it on I'll post it on a meet-up later I also created something let's skip that one so yeah this is I created my own mappings for everything so I have like ctrl P for buffers ctrl G G for AG leader leader for commands and ctrl P for fzf omni files which is a function that i wrote and what it does is it checks if you're in different directories of get directory does they using a system and then for some reason and if you know the answer to that please let me know it won't let you execute system like this without the per am without assigning it to something I'm not sure why but if I assign it to something and then I check the V shell error then it will tell me if I'm in the get directory or not so I can use files or get files depending on a directory also gives you intermode completions I think they're like cool but there are better tools for that so if I'm let's jump to here let's add another this is a rake file I'm going to add another task and I'm going to start with desc so I started writing it I do control X control l well no that's not the right one Sood yes control X control ail there you go so now I can see all the different uh desks and I can autocomplete based on that I think it's okay it's not that great like the plugin that you saw in the beginning when I had this mistake it's that's my favorite if I just do tab yeah this one not sure which one it is but it works way better but if you want to customize that you can also do that so building your own tools to autocomplete the text say writing it can be a pretty interesting scenario so that's my Omni files and you can also create your own fuzzy commands so I'm going to show you how to do that he gives you some example for example locate so this is just a command we call it locate takes one argument and then you do FCF run you can pass it like some hash here that contains a source you tell it what is the source data that you're putting in and the sink and the sink is like after these are selected something put it through the sink in this case it's e like edit the file and you can give it some options those are all documented in the help file I built my own so I showed you in the beginning how I switch branches so I took that command and I put it in my bin so so change branch all I do here is I find a function I do get check out and this function takes one parameter so get check out that parameter and that would be the sink right so after that I do call any bank to reload the print file and I also update my airline that's this stuff right here then I also show message to the user that I change the branch here is a command itself G branch so the source this is a data that comes into it it's just get branch and then the sync I call the function this is the function I define here options - - M I actually just press it I have no idea what it does I'll probably need to look it up but down 20% what that does is it opens it instead of fullscreen the default is fullscreen it opens at 20% below my current screen integrates really nicely with team-ups by the way so it's not really a vim split but rather a team-up split so let me show you how that works I'm going to jump to Rails and let's find the rails file here this one and right now we're in the lock FFI branch and i want to switch back to master so I'm going to do G branch already load my Kumar scene okay Jeep wrench let's go to master so loaded it reloaded the file and refresh my airline so that was pretty easy I think stuff like that this is a obviously a pretty simple example but stuff like that can become very time-saving so like I mentioned it overwrites AG and for some people it can be a deal breaker but it doesn't have to be because it has this function let G fzf command prefix give it whatever prefix and then calling files become fzf files the same for fgf8 G so really useful and I'm going to show you an extra bonus that's something I stole directly from the author's DMRC he used something called code ray to show a file preview so I'm going to go to here let me go here close this show you're gonna close everything so if I'm here and I'm doing calling files now I have a preview on the right and as I go through the files I can see what it would look like and for most of them you're just going to see the syntax highlighting - so that's as you type files for example streams you can see what it is and you can say like actually that's the file I want so I'm going to jump into it so this is another extra bonus and that can be if you're interested in that you can steal that from the authors of your mercy that's it so it's a short talk we have office hours right now so it's kind of like open for you to talk to everybody where we want and ask us questions we'd love to learn from you as well like Jake said we have lightning talks coming up and we really really like when other people talk they're not just a truck with people so yeah I'd love to have you here two slides all the sides are writable on bitly slash Vinci - f c/f - talk and this is my twitter you want to send me any tweets that's it thanks again for high any questions oh that's fine yeah yeah mono colors and your font like your airline very different yeah so I used to use power line and I switched your airline because it's way lighter doesn't require to compile with Python I believe in terms of the fun I think I'm using the patched version of mono fur you see if I'm correct yeah so it's a moniker for power line so that allows you to have those like sharp edges here and the power line or air line if you will color scheme is just tomorrow night everything else is kind of I built myself I guess I like customize myself my own colors that's what the what I I don't know that it affected the startup time but it did affect when I was running my dog files on a Raspberry Pi and that didn't have been compiled with Python and compiling something on respirator is really painful so I was like I decided to just ditch it yeah it's like you have to hit the make file with a certain flag to get it to compile in Python and and trying to installed Ruby owner Raspberry Pi was was was painful actually never completed any more questions all the preview ok so I think I put this on my behavior modification yeah so this is the thing that I stole directly from his VMRC he uses cadre which is a gem and this is what it looks like files for some reason doesn't work on get files on the warps of the files so I'm gonna maybe push a pull request to his project but it lets you like preview all the files on the right I don't know how it does that it's pretty magical oh yeah so that's why I said fzf integrates really nicely with T MUX so this is actually a team ox paint that I can resize with my mouse uh it's not a part of team ox I don't know how he does that he probably like converts it using code rate into like the colors to correct colors in bash bash code and then displays it somehow not really sure how is it's pretty horrible um so I know this is effectively with Apogee's what I've been telling you is that this feature let's get with the other feature that it us in this pain goes away but that does that is when disrupts or last pain and if you rely on that navigate sequence Thanks yes Celtics no Josie of oh well I prefer I guess would be leader sample Peter semicolon so our trouble ain't for outlets like a box pain yeah as opposed to the other way into it you know which would they actually switch but it just that and right for me yeah for me leader semicolon does something else but uh yeah I I think you're right I think it does this yeah I have a different set up but I think yeah I just do control Z L and controls eh but uh awesome each try to place the last pain restore it after absolutely probably probably so it's a native sample eaters it will go the last yeah that's like I don't you ever hats okay I do have that okay so let's let's try that and I'm going to do files that open the new team ox pain and now I'm going to pick one and I'm gonna do ctrl semicolon no less banks you're right yeah yeah it does break that yeah that's it's not impossible for blue requests here that's Roger yeah more questions not feel free to grab more pizza [Music]
Info
Channel: VimChi
Views: 26,214
Rating: 4.9519038 out of 5
Keywords: hashrocket, vim, chicago, vimchi, fzf
Id: aXPQTesFdTI
Channel Id: undefined
Length: 35min 52sec (2152 seconds)
Published: Fri Dec 09 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.